Posts

Showing posts from October, 2017

ESP8266 Geo-location and calling the underlying C libraries

My interest was piqued by this document - it proposes the following means of getting an ESP8266 to work out where it is on the planet: Scan for nearby APs, getting  SSID MAC address RSSI (signal strength) Make an API call to Google's Maps API, passing this info and getting back lat/lon with a likelihood radius The only drawback is that this is done using the AT command set that the ESP8266 supports, rather than the Arduino libraries. Hurray. Let's look at the Arduino library support, and we find WiFi.scanNetworks() . This is demonstrated in the ESP8266WiFiScan example, but however doesn't return all the required information, only SSID RSSI Encryption type (an enumerated type) Bummer. It works ok, quite cool, but... So how do I get to the same function as the AT command set?  There is a lower level C-type interface to the chip's functions, in the include file <user_interface.h> . This is demonstrated in CallSDKFunctions, where the functio

ESP8266 WiFiMesh looks interesting

http://www.espressif.com/sites/default/files/30a-esp8266_mesh_user_guide_en.pdf https://links2004.github.io/Arduino/d0/d06/class_e_s_p8266_wi_fi_mesh.html https://gitlab.com/BlackEdder/painlessMesh Mesh is a means of getting the ESPs to build a wifi mesh to reduce the number of upstream AP connections, and also to make an overall system more reliable, arguably. In fact that's a great idea... I might have to think about that. And the "group"? concept, I can't recall the proper term, but there is a Java library for that. It was developed by Tandem so their systems could add/lose nodes without falling over.

ESP8266 Weather Reporter - problem solved!

OK! I tried a different NodeMCU board (I have 2), and it behaved exactly the same i.e. random memory-based exceptions. I use the ESPExceptionDecoder to see where it was crashing out - always in a Print::write function. What could it be? Looking closely at the  nicked code, it used a String object to collect data from the web response one character at a time, before turning the whole thing into an array to pass to the JSON parser. Hmm. Previous experience with C++ has made me very very suspicious of C++ object data types, and the wanton use of memory in the handling of function calls. Basically, there's masses of malloc/free or equivalents on every call, copying parameters etc. And it doesn't all get freed... Anyway, switched my buffer to a char [] array of a fixed size, and put a limit on the number of characters put into it. Easy! Let's face it, there aren't unlimited resources on the chip, only 40k left of stack, so best to set some limits. It's now failed,

RTL8710AF - continued

I was a bit disa ppointed by this hackaday project , but it did at least give some ideas. The subhead " Recent progress of WiFi modules does not need external MCU anymore. Now I just try to focus on ARM Cortex-M3 based RTL8710! " was a bit of a tease!

RTL8710AF - a longer story!

About a year ago, I was made aware of WiFi+CPU SoC devices at one of the Reading Geek Night meetings. They looked pretty cool... So I investigated a bit, and because at the time, from what I found, the RTL8710 looked useful, and was available in an RTLDUINO format, I bought one on AliExpress. From China. Eeek! It arrived... along with some other stuff I've yet to decipher, but hey... Anyway, I loaded up the Arduino IDE with the Ameba dev kit, and had a go. Plugged the NodeMCU-sized board into the USB, a light flashed, hurrah. Except I couldn't talk to it at all. More research revealed that the RTLDUINO is part of the ARM Corp's IoT ecosystem, and requires a development motherboard, which cost more. Boring. So I chucked the board in a box - I think it cost me $8, no harm done. I did find a lot out about many things as a result though... Incidentally, AliExpress is a geek's goldmine - a bit like the market in Bladerunner, I'm surprised you can't buy replicant

ESP8266 - Solving problems

I have been playing with using ESP8266 to access openweather.org's API for current weather. The data is received as a JSON structure, documented here . The original code I stole was actually crap - it didn't attempt to parse the JSON correctly, merely removed the array-indicating "[]" and parsed it as a flat structure! Needless to say, it broke once there was more than one entry in "weather"... Took me a while to realise that. Next was having the device crash, with a couple of different exceptions, all pointing to something memory-based.  So I tried clearing the JsonBuffer structure between parse attempts, which seemed to help. Still kept crashing - I tried doing the API data fetch once, and repeating the parsing endlessly - no crashes! So it looks like something in WiFi/WiFiClient that is giving me problems. Maybe I need to initialise it each time... Right. This is dull. It's almost completely unpredictable, which makes me think it's not th

NodeMCU ESP8266 - getting started

I got an ESP8266 a while back from AliBaba, but it needed another board to allow it to talk to the Mac. So on the prompting of friend Matt, I bought a couple of NodeMCU-based boards to try them out. The attraction of the ESP8266 is that it has wifi built in, so your project can do something useful right away with no additional components e.g. Find something out and tell people Be queried for its current state using standard browsers and Internet-stuff. Nice. Interesting pages ESP8266 Exception Causes RTL8710 CH340 Driver page NodeMCU Board Documentation NodeMCU LUA Documentation Expressif Documentation

A Long Story...

I've had an Arduino for a year or two, and fooled around with it, and not blogged anything. Bad me. So here's the blog...