Rather than make a definitive how to guide I wanted to start sort of a discussion/development thread on getting the brewpi's arduino wirelessly connected to the pi (or linux machine) via a wifi adapter. I'm specifically referring to the new(ish) and popular esp8266.
This assumes that your are familiar with wiring up uControllers. Don't forget that the esp8266 needs a steady 3.3v power supply with 500 - 800 milliamps (if I remember correctly), and your 5v+ power supply to your arduino will fry your esp8266. I'll leave wiring diagrams and circuits for another post. I suggest looking into the LD1117 voltage regulator.
A few months ago I had the chance to play around with this and had a mostly working prototype.
The first thing I had to do was acquire an esp8266 module. These modules come several different variants. While any variant will work (I think), a variant with GPIO12 broken out is very convenient in that you can hook it up for wirelessly reprogramming the arduino. I chose to use variant esp-03. Variant esp-01 already has header pins on the breakout board and if you are not worried about wirelessly reprogramming the arduino this may be the easiest variant to get up and running. I assume that most people aren't re-flashing their arduinos after initial setup anyway.
The next thing to do is find some firmware that will allow the esp8266 to act as a "transparent serial bridge". In other words, all it does is act as a wireless serial communication relay sending and receiving serial data over your wifi network. There are a few different projects out there, I chose to go with the esp-link project as it had the wireless flashing feature mentioned in the last paragraph.
If you used the esp-link firmware and followed the setup instructions from it's project page you should be able to access your esp from an ip address like http://192.168.1.70 for example, and to access it as a serial relay you would go to port 23 (http://192.168.1.70:23). I believe that the firmware has since been updated to give the esp a host name so you can name your esp to something link esp-brewpi and access it like http://esp-brewpi:23, refer to the github project for more info.
After you've confirmed that your esp is up and running and connected to your network you need to setup the brewpi scripts on the raspberry pi (or what ever your server is) to access the arduino via wifi instead of serial.
To do this you will need to adjust a couple lines of code in the brewpi scripts. The first thing is to change the line in BrewPiUtil.py:
to
That will be around line # 130.
And the second is to change the port variable in the config.cfg file from this:
To something like this (this depends on your setup):
After you make those adjustments and reset your brewpi scripts it should be good to go.
At this point I had some issues with periodically dropping the wireless connection but I think it had more to do with a poor power supply to my esp8266.
For those of you wanting to try to use the esp8266 with your brewpi setup I hope the above information will be helpful in at least steering you in the right direction.
esp8266 variants: http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family
esp-link: https://github.com/jeelabs/esp-link
brewpi-script/BrewPiUtil.py: https://github.com/BrewPi/brewpi-script/blob/21caa7a408a7fe0ede08b544c8768b9d8c902d7d/BrewPiUtil.py
brewpi-script/config.cfg: https://github.com/BrewPi/brewpi-script/blob/015e5c7040672af9e0dc3045ac1b681036c372d6/settings/config.cfg.example
This assumes that your are familiar with wiring up uControllers. Don't forget that the esp8266 needs a steady 3.3v power supply with 500 - 800 milliamps (if I remember correctly), and your 5v+ power supply to your arduino will fry your esp8266. I'll leave wiring diagrams and circuits for another post. I suggest looking into the LD1117 voltage regulator.
A few months ago I had the chance to play around with this and had a mostly working prototype.
The first thing I had to do was acquire an esp8266 module. These modules come several different variants. While any variant will work (I think), a variant with GPIO12 broken out is very convenient in that you can hook it up for wirelessly reprogramming the arduino. I chose to use variant esp-03. Variant esp-01 already has header pins on the breakout board and if you are not worried about wirelessly reprogramming the arduino this may be the easiest variant to get up and running. I assume that most people aren't re-flashing their arduinos after initial setup anyway.
The next thing to do is find some firmware that will allow the esp8266 to act as a "transparent serial bridge". In other words, all it does is act as a wireless serial communication relay sending and receiving serial data over your wifi network. There are a few different projects out there, I chose to go with the esp-link project as it had the wireless flashing feature mentioned in the last paragraph.
If you used the esp-link firmware and followed the setup instructions from it's project page you should be able to access your esp from an ip address like http://192.168.1.70 for example, and to access it as a serial relay you would go to port 23 (http://192.168.1.70:23). I believe that the firmware has since been updated to give the esp a host name so you can name your esp to something link esp-brewpi and access it like http://esp-brewpi:23, refer to the github project for more info.
After you've confirmed that your esp is up and running and connected to your network you need to setup the brewpi scripts on the raspberry pi (or what ever your server is) to access the arduino via wifi instead of serial.
To do this you will need to adjust a couple lines of code in the brewpi scripts. The first thing is to change the line in BrewPiUtil.py:
Code:
ser = serial.Serial(port, baudrate=baud_rate, timeout=time_out)
Code:
ser = serial.serial_for_url(port, baudrate=baud_rate, timeout=time_out)
And the second is to change the port variable in the config.cfg file from this:
Code:
port = /dev/ttyACM0
Code:
port = 192.168.1.70:23
After you make those adjustments and reset your brewpi scripts it should be good to go.
At this point I had some issues with periodically dropping the wireless connection but I think it had more to do with a poor power supply to my esp8266.
For those of you wanting to try to use the esp8266 with your brewpi setup I hope the above information will be helpful in at least steering you in the right direction.
esp8266 variants: http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family
esp-link: https://github.com/jeelabs/esp-link
brewpi-script/BrewPiUtil.py: https://github.com/BrewPi/brewpi-script/blob/21caa7a408a7fe0ede08b544c8768b9d8c902d7d/BrewPiUtil.py
brewpi-script/config.cfg: https://github.com/BrewPi/brewpi-script/blob/015e5c7040672af9e0dc3045ac1b681036c372d6/settings/config.cfg.example
Last edited by a moderator: