August 31, 2015 at 11:54 am #40057
I was wondering if you’d considered using an ESP8266 instead of an ATMEGA to run the OpenSprinkler. I’ve been playing with some of the development boards (ESP-01, ESP-07 and ESP-12E) recently. They might be short of a few GPIO pins on the current hardware design, but for the cost of the ATMEGA1284, ENC28J60 and RJ45 port you can buy several ESP devices especially if you don’t buy the ESP-XX boards. They have incorporate the following:
1. Factory MAC address.
2. Built-in Wifi.
3. 80MHz CPU.
4. 80KiB RAM
5. (external) 512KiB to 4MiB SPI FLASH, 64KiB to few MiB of that can be dedicated to SPIFFS, and if your sketch uses less than half the flash you can do OTA updates.
There has been a lot of work recently on Arduino IDE compatibility and most of my sketches just work. The WiFi connection is also very stable and has none of the oddities that the ENC28J60 Arduino library has in it.
One thing that has made my life so much more simple is OTA updates.
I’m going to try building an OpenSprinker based on this chip over the next month or so.August 31, 2015 at 1:08 pm #40058
I like this idea… I’d love to see a smaller, more distributed control system… .hopefully this could fit into the Master-Slave logic eventually.August 31, 2015 at 11:46 pm #40084
@ianf: a great suggestion. I have actually been experimenting with ESP8266 quite a bit a little while back and I’ve developed the ESPToy:
The pricing, Arduino IDE support, community support, and hardware capability all make it a very attractive platform. There is no immediately plan to change OpenSprinkler to use it yet, mainly because even though it looks like a better platform, it takes time to iron out all engineering issues. Instead, we are working on a different product that uses ESP8266, which will pave the way for OpenSprinkler to eventually use ESP8266. In any case, if you build an OpenSprinkler based on ESP8266, be sure to share it. I am sure many people are interested. Thanks.October 26, 2015 at 4:31 pm #40624
I’ve just completed the first prototype (hand etched and soldered). Once I’ve ironed out the issues I’ll put up the cad files somewhere.
Just a question. Will you be willing to include the #def stuff in the OpenSprinkler repository to enable the ESP8266 platform?
- This reply was modified 4 years, 1 month ago by ianf.
Attachments:November 1, 2015 at 10:59 pm #40652
Thanks for making progress on the project and sharing the picture. I think enabling ESP8266 definition in the repository requires assigning GPIO pins. I haven’t decided how to assign the pins (or even if ESP8266 has sufficient on-board pins to support all the OpenSprinkler functionality). The current list of pins are:
– buttons: 3 digital (can be implemented with 1 analog pin and resistor divider instead)
– shift register: 4 digital
– LCD, RTC: I2C (can be shared with as many I2C devices as needed)
– rain sensor and flow sensor: ideally 2 separate digital pins (1 if allowing only one sensor at a time)
– expander sensing pin: 1 analog
– current sensing pin: 1 analog
– RF transmitter: 1 digital
– sd card: SPI (if using SD card)
So overall these are quite a number of pins. Even with the new ESP12E module, it may require a IO expander chip.November 3, 2015 at 6:45 am #40671
The ESP-12E has extra pins broken out but I believe you can’t use them without interfering with the SPI Flash interface which will affect program execution. I’ve based my prototype on the ESP-07, the only real difference between this and the ESP-12 is the ESP-07 has 1MB flash and a ceramic antenna with u.fl external antenna connector while the ESP-12 has 4MB flash and no external antenna interface. Otherwise they are interchangeable.
For now I’m focusing on a minimal hardware implementation to prove the concept. As you can see in the picture, I’ve moved the LCD to a PCF8574 but I messed with the pin assignment to make the layout easier so I’ve a hack to the LiquidCrystal_I2C library. The second SOIC-16 footprint is for another PCF8574 to provide the additional GPIO. I considered just attaching the 74HC595 to the SPI bus (in hindsight I think it should have been done like this from the start) but I’m not sure how invasive code-wise this change would be.
I see now that I should have connected B2 and B3 to the IO expander rather than the ESP module to free up a GPIO to use as an interrupt for state changes like buttons, and other sensors.
The only real gotcha is the ESP8266 has one ADC channel. I guess this can be remedied by either an I2C analog mux or ADC.
At present, I see enabling the ESP platform requiring the following:
1. Inclusion of the LiquidCrystal_I2C library with private changes.
2. Abstraction of the GPIO to use PCF8574/5 ICs
3. Some pin definitions as you’ve stated.
4. Some #ifdef magic to filter out the Ethernet library in favor of the ESP8266WIFI and cousins.
5. Some #ifdef magic to deal with the ESP8266 flash emulated EEPROM.November 5, 2015 at 12:09 am #40690
There are actually ways to minimize the number of pins for 74HC595, by cleverly using capacitors to control signal timing:
If you use Arduino for ESP8266 (https://github.com/esp8266/Arduino), you should be able to use LiquidCrystal_I2C library directly with no modification. Also, you can buy I2C LCDs that have built-in PCF8574 so that saves one chip.
With the shift register trick, I think it’s possible to eliminate a separate I/O expander chip. I do think it’s necessary to have an ADC chip — the PCF8591 chip I used for OSPi is probably sufficient, and there are tons of alternative ADC chips out there.March 1, 2016 at 1:47 am #41634
Hallo to everybody
Before yesterday I discovered this trhead ,I have spent last 2 weeks triing to port Opensprinkler to ESP 8266, and I have now a version with most of the functions that compile and run……. but I need to debug it…….
To tell you the full story, I started several months ago with the idea of automating my sprinklers unit in my garden: I have now 4 traditional programmers (raybird , irritrol and other ) located in different points in my garden and I allways run from one place to the other to program the units and check that programming time do not overlap. I started a thread on Arduino forum to get suggestions and to discuss best solutions with very little feedback. At the time I discovered the ESP8266 and I understood that was a perfect candidate for my project….. I started to write some software with the idea of a master unit that should have coordinated the other programming units.
A month ago a discovered Opensprinkler that could have been the perfect candidate for my remote slave units and since was based on Arduinos could have been ported to ESP8266. I started downloading and modifiing a version alreay ported to Arduino Mega from Dave1001.
After having ported release 2.0.0 last week I started with last release (much more challenging….) but thanks to previous work I succeded .
Now I have to verify that everything works!!
I am working on a small prototipe unit that use a ESP8266, a DS1307 compatible RCT and an I2c 4*20 LCD and a shif register IC that drive triacs. Since ESP has very few GPIO available every effort need to be done to reduce the one required to the units!
I ready to share my work but I will appreate a little help to make it fully working and to accomplish a few modifications that I need to do…..
PaoloMarch 7, 2016 at 9:03 am #41667
I’m very interested in your work – it’ll potentially save me a bunch of time porting the software. Please contact me off-line at ianf () freislich ! nom ! za and I’ll share my work. If you’re located in the USA I’ll make another board and post it you. It’s not yet ready for prime-time but I’ve attached a picture of the 3rd prototype board I made yesterday (changes are the micro SD and DS3231 RTC). I need to figure out what’s wrong with the SD interface and the soldering is rubbish because I had to de-solder and then re-solder most of the components by hand. This is the first board I made in my T-962A reflow oven and there were a bunch of shorted tracks. I’ve kept the layout single sided so I can run the boards off by hand while it still under development.
Truth be told, I’m considering loosing the 74HC595 shift register in favour of the PCF8574 I2C PIO chip. It will fee up some pins and simplify things somewhat including expansion board detection which can just be done with an I2C scan and DIP switches to set the address of the expansion board.
Attachments:March 8, 2016 at 1:55 am #41683
I have started a bit of prototyping myself. Like your design, I am using a PCF8574 to expand the number of I/Os. Regarding SD card, one technical issue I encountered is that if you use the default CS (chip select pin), that would be ESP8266’s GPIO15, but the boot sequence requires GPIO15 to be pulled low at start-up, and that contradicts with SD card requirement, which is that CS pin must be pulled up to disable SD card operation. So you will need to use a different GPIO pin as CS pin. Not sure if this is the same issue as you encountered, but just a tip.March 8, 2016 at 4:08 am #41685
Ray and Ian
thanks for your replay!
How can I contact you at…..nam!za?
I appreciate very much your offer of one of your boards: as you can see from the pictures I am very basic in electronic prototyping:
– first picture is a proto complete and running that use 74HC595 an RTC DS3231 , a 20*4 LCD I2C and an analog pin for buttons
(better to foreseen this option in you breadboard)
– second one is (not yet complete..) with PCF8574 …(having most pins free) I will go with digital buttons ( to enable double pressing)
On both board there is no SD card …I use instead SPIFFS that emulate an SD on the ESP flash.
This is the best I can do, as far as proto boards, hand soldering and use of stripboards. I also use existing boards as far as possible:
for ESP8266 this an NODEMCU v1.0, for RTC this is ZS 042 with a 32k EEPROM pin .
The way I have ported the software should maintain full backward compatibility therefore I can select different kind of hardware just using few #define
I testing now…debugging on first propotype…… I will start soon with the second!
I don’t use SD card since I want to have more GPIO available and I cannot afford to use 4 for SPI : I want to leave the pins for future development for local data acquisition (temperature, humidity and rain amount ) since local Wunder stations are not very reliable and I will use one of the stations in a glass house.
As far as use of pin on ESP8266 (in my case NODEMCU 1.0) I made a table on attachment 3 : as you can see 3 pins are use for flashing and booting the unit (better you dont use it). Unfortunately ESP are not so well documented and the n. of pin available is very short(better to use ESP8266 v1.2+ or NODEMMCU 1.0+).
Other point: I have preferred to use of an external I2c EEPROM rather than using ESP flash memory (could be erased) since I don’t believe there is any speed issue.
One question: how can I modify the weather algoritm ( it is done outside the code )?
I have seen a lot in the forum but it is only related to the Raspberry PI and is done with plug-in!
Attachments:March 8, 2016 at 9:06 am #41689
Try replacing ‘()’ and ‘!’ with ‘@’ and ‘.’. I hate to have to obfuscate but the spammers have ruined it for everyone.
IanMarch 9, 2016 at 2:58 am #41695
I add the attachment with ESP8266 pinout (this is NodeMcu but the GPIO n. are the same) : you can see possible utilization of different pins!
SD emulation on SPIFFS work well but I have some problem with wopts.txt file : it has been deleted and it doesn’t create it again.
I dont understand his use ….. everything work without it!
Attachments:March 10, 2016 at 8:30 am #41708
Hi I’m also interested in this project. If you could post your code and schematics (maybe open a github page would be easier for everyone). I could help in debug.March 11, 2016 at 7:50 am #41715
I have to complete debugging,
but as soon as I have documented what I have done I will put the code on GitHub!
A let you know when it will be ready!March 11, 2016 at 6:49 pm #41723
OK, I’ll start building and help you debug as soon as you post your design.March 12, 2016 at 1:37 pm #41724
HARDWARE for OpenSprinkler with ESP8266.
The code is compatible for several different hardware configurations:
MCU: ESP8266 or ARDUINO MEGA
VALVE CONTROL: SHIFT REGISTER (like 74HC575 …. ) or I2C EXPANDER (like PCF8574)
RTC DS1307 or DS3231 breadbords with I2C epproms (like AT24C32 )
LCD LCD1602 or 2004 with parallel or I2C interface (or driven with a PCF8574)
BUTTONS on ANALOG or DIGITAL Inputs Lines (or trough a PCF8574).
So to start debugging it will be necessary to have at least one ESP8266 (better a NodeMCU v1.0 ) a RTC clock board (with EEPROM) and an LCD (better with I2c interface).
It will be good to have or a SHIFT register chip (like 74HC575) or a PCF8574 : leds can be used for debugging ,
later we can go with relay boards or with a simple Triac circuit.
Remember that voltage level for ESP8266 is 3.3V and this apply to all pin (5V is no good) better to verify that I2C components are 3.3V level compatibles…..
or to have a level shifter!
I am preparing a Fritzing project for components connection that can be done easily on a standard breadboard.March 12, 2016 at 4:00 pm #41725
That’s great! Can you upload the code?March 16, 2016 at 11:06 am #41750
@pbecchi: regarding storing wtopt.txt SPIFFS, it might have to do with the parameters you used when calling the SPIFFS.open function. There are a number of different options, like ‘w’, ‘r+’, ‘a’, ‘a+’. If you are reading from an existing file and modifying it, use ‘r+’; the ‘w’ parameter will cause the file to be overwritten.
I just finished and posted my OpenGarage project:
if you go to the Github repository:
you can find the code relevant to the configuration files (config.txt). The code is able to create a new file if it doesn’t exist, modify it or delete it upon factory reset.
March 19, 2016 at 5:56 am #41772
- This reply was modified 3 years, 8 months ago by Ray.
Thanks Ray for your suggestions!
I want to inform you and everybody interested that
you can find first beta release of OPENSPRINKLER ported to ESP8266
Look forward to your comments and suggestions!
March 20, 2016 at 10:27 pm #41810
- This reply was modified 3 years, 8 months ago by pbecchi.
Cool, very impressed with the level of details you have provided. I have bookmarked it and will check it out in a few days.March 21, 2016 at 6:20 pm #41825
I didn’t have enough time to build the project but I was able to compile it. I had problems with (#include ../) statements. I fixed this by moving all files to the same folder and get rid of (../). Also the LiquidCrystal-I2C-library that you linked didn’t compile and I used this one https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/LiquidCrystal_V1.2.1.zip
I will probably build the proto 2 circuit tomorrow but I couldn’t figure out where you declare the I2C addresses. It would be helpful if you can post a circuit schematic.
Thank you for your effort, great job!March 22, 2016 at 1:18 am #41828
I am glad you could get already there! As I told you I need to complete documentation:
yes , if you are using Arduino IDE you need to have all files in the same directory and to delete “../” from include statements.
about lcd i2c library….. there is a large choise
Declaration of all pins are in pins.h file for i2c use standard D2,D1 orchange it to your needs
Anyhow…… today I will add documentation for compile and build and the sckematicsMarch 23, 2016 at 6:16 am #41837
I’ve build the circuit lcd and opensprinkler work but it doesn’t recognize the PCF8574 so no output.This is the serial output `wire begin
I2C device found at address 0x21 unknown
I2C device found at address 0x27 unknown
I2C device found at address 0x57 AT24Cxx
I2C device found at address 0x68 DS3231
Setting software MAC
Using http port 80
Reading password file….
6 networks found
0: home_No_internet (-46)* passw. available
1: Pargas_Distillery_Amicos_f&bar (-75)
2: home_No_internet (-77)* passw. available
3: Pargas_Distillery_Amicos_f&bar (-45)
4: 01.EpavliVeneti (-89)*
5: Test (-66)*
Connecting to home_No_internet
Server started IP=192.168.1.4
Local IP: 192.168.1.4
Gateway IP: 192.168.1.39
DNS IP: 192.168.1.39
DHCP IP setup successful
Ethernet setup complete
`March 23, 2016 at 7:19 am #41838
I am impressed ………………..you are really fast:
-this is a bug in ScanI2C() already corrected : look at the new branch I have uploaded yesterday!
-remember that as the code stand now the I2C LCD has his own library
so his address should be given with #define LCD_ADDR 0xnn otherwise is will be considered an expander.
Web Server works? No other bugs? Logging doesn’t work am working on it!
Since your so fast… I will try to answer ASAP….but consider time zone (I am in Europe!)
- You must be logged in to reply to this topic.