Implement lightsw IoT device
|Status:||In Progress||Start date:||04 Mar 2018|
|Target version:||Iron Man - 002 - MVP|
|Severity:||04 - Low|
This is code for the ESP8266 to act as a lightsw. It is an extension of the generic ESP8266 code I'd worked on previously, but redesigned to adhere to the defined protocols for Ironman.
First, getting back to working with the ESP-01 took a while. My layout on the breadboard was klunky so I reworked it and things stopped working. It took quite a bit of time before I found the problem.
If you power the ESP-01 from it's own 3.3v source, then the FTDI board used to program it must have the same ground. If not then any attempt to program gets stuck while the PC tries to connect to the ESP-01 bootloader. I'll post some pics for this setup later.
After fixing that I can upload and run the old esp8266 sample code I had. It will boot into the WifiManager hot spot for configuring the board using 192.168.4.1 and the AP "imiot". However, the lightsw code, which was based on that, doesn't work.
Now I need to run meld to compare the two modules and see why the new code isn't booting into the wifi manager.
Also: If I use the Arduino IDE, I have it pointing at 1.6.7. I should update this to the 1.8.4 version, using "latest" as a symlink and pointing ~/bin/arduino to that. See also: https://github.com/esp8266/Arduino.
There is a prime example, nearly identical to what I'm trying to do, on this website:
The section on Driving a Relay and Reading a Push Button using GPIO0 / GPIO2 is what I need to implement.
FYI: my current code for imlightsw wasn't working because of my incorrect use of GPIOs. The example code above should fix this (along with some hardware mods to the breadboard).
There's also this article, which is probably a little closer: http://acoptex.com/project/304/basics-project-021e-esp8266-esp-01-wi-fi-module-5v-relay-modules-webserver-at-acoptexcom/