Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By jimmayhugh
#19916 As an exercise, I threw together a fairly simple WiFi Temperature Controller that uses Avahi for network discovery, 1-Wire DS18B20 Digital Thermometers, DS2406+ Digital Switches, and an I2C-controlled 20x4 LCD. Here's a photo:

Image

The board with the DS2406+ switches is described here, and the LCD setup is here

The code is at my github, let me know what you think.
User avatar
By jimmayhugh
#19972 I've updated and added some software at my github that controls the two available DS2406+ Switches.

I've also added a short PHP utility that will communicate with the UdpTempController and allow the state of the chips to be monitored and set.

To use it, you'll need PHP5 and avahi-resolve installed.

On the command line enter
Code: Select allphp TestUdpTempController.php esp8266.local


The program will attempt to locate the UdpTempController, and if successful, will display the IP address of the UdpTempController, and prompt for input.

Any input other than 'A', 'B', "AN" or "BN" will display the current state of the chips in a comma delimited string:

Code: Select allccc, fff, a, b


Where "ccc" is the temperature in degrees Celsius, "fff" is degrees Fahrenheit, while 'a' and 'b' is the o(N) or o(F)f state of the respective switch.

"AN" turns the first switch discovered ON, 'A' turns it off
"BN" turns the second switch discovered ON, 'B' turns it off

Let me know what you think.
User avatar
By jimmayhugh
#20370
Torteski wrote:Hi there,
Thank you for posting this is exactly what i was looking for.
Could you please write a bit more on the hardware setup (wiring etc.)
Thank you again


This is just a testbed, when I'm happy with it, I'll create my own board.

I use an Adafruit level converter to convert the ESP8266's 3v3 levels to the 5v my boards use. A simple diagram would look like this:

ESP8266---3v3 I2C SDA----level converter----5v LCD SDA
|---3v3 I2C SCL----level converter----5v LCD SCL
|---3v3 1-Wire------levelconverter----5v 1-Wire