Wireless Brewpi Via Wifi

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Well yes, my changes were for the current version that you would get following the install guide; http://docs.brewpi.com/manual-brewpi-install/using-git-for-brewpi.html

(edit) the second timeout is important, heres a screenshot of my git diff/version

So close, don't give up. That time_out change on the serial.serial_for_url command I'm pretty sure caused that behaviour as it wasn't waiting long enough for the reply.

git-brewpi.JPG
 
Brilliant!

I totally missed changing the timeout value as you had shown in your earlier post. Two ******* moves in one night.
(Wish that was a new personal record but I'm pretty sure I've done even worse at some point in my life ;))

So I just changed it to "1", restarted the script, and every friggin' thing is working perfectly - just like it does with the BT radio in place of the ESP.

Apparently the latency - from my 100Mb hardwired R'Pi through a network switch, a Gb router, a WAP that's dedicated to our low-bandwidth appliances and then through the ESP - is a lot higher than through the RPi BT dongle directly to the minion BT module - even though the RPi BT dongle is hosting three BT slaves.

That was the last chapter for the blow-by-blow procedure to make this happen.
I just need to cobble a simple diagram and I'll drop it here...

If you ever find yourself in my neck of the country, you can have your way with my keezer :D

Cheers! :mug:
 
There's always one more thing.

Have either of you with working ESP modules ever tried programming the BrewPi AVR firmware over the Wifi/Serial link using the BrewPi web gui?

I wanted to verify that the ESP with esp-link will support uploading new BrewPi AVR firmware, so I switched the ESP to "esp-01(AVR)" mode from the "esp-bridge" mode I've been using (that mode supports both CONN and SER LEDs, which definitely made debugging this a lot easier) then hooked up GPIO0 to the UNO RESET pin.

I verified that the reset function worked by whacking the UNO from the ESP web gui (handy feature on the uC Console page).
Then I grabbed the latest AVR firmware from Github and launched the Reprogram Arduino function from the BrewPi gui. Here's what happened:

Code:
**** Arduino Program script started ****
Settings will be restored if possible
Devices will be restored if possible
Nov 30 2015 21:53:54 Opening serial port
Checking old version before programming.
Checking current version: Found BrewPi v0.2.4, running commit 2a6f7f05 build 40, running on an Arduino Uno with a revC shield on port socket://192.168.1.230:23

Requesting old settings from Arduino...
Saved old settings to file settings-Nov-30-2015-21-54-02.json
Loading programming settings from board.txt
Checking hex file size with avr-size...
Program size: 26896 bytes out of max 32256
Nov 30 2015 21:54:04 Opening serial port
Programming Arduino with avrdude: /usr/share/arduino/hardware/tools/avrdude -F -e -p atmega328p -c arduino -b 115200 -P socket://192.168.1.230:23 -U flash:w:"brewpi-arduino-uno-revC-0_2_10.hex" -C /usr/share/arduino/hardware/tools/avrdude.conf
Result of invoking avrdude:
avrdude: ser_open(): can't open device "socket://192.168.1.230:23": No such file or directory
ioctl("TIOCMGET"): Inappropriate ioctl for device

avrdude done. Thank you.


There was an error while programming.
Nov 30 2015 21:54:04 New program uploaded to controller, script will restart
Nov 30 2015 21:54:10 Opening serial port
Nov 30 2015 21:54:10 Notification: Script started for beer 'RPINTS BrewPi4 Test7'
Nov 30 2015 21:54:20 Checking software version on controller... 
Nov 30 2015 21:54:20 Found BrewPi v0.2.4, running commit 2a6f7f05 build 40, running on an Arduino Uno with a revC shield on port socket://192.168.1.230:23

Sooo....aside from the 115200 baud rate specified by BrewPi (I'm running the ESP at 57600 as that's the original BrewPi firmware default for the UNO) it appears that avrdude doesn't know how to handle the port name for the ESP.

If the AVR code can't be loaded OTA it's nbd to me - that doesn't work over Bluetooth, either.
And I haven't updated the firmware for a year anyway (still running 0.2.4 as shown above).
But it would be that much cleaner if it did work through the gui.

I'll have to see if the suggested method shown on the ESP gui page can suffice...

Cheers!
 
Yes. I wired the relevant pin and used the web console to change the baudrate to 115200 first.

Also note the correct pin assignment in esp-link, mine is
esp-01(AVR): reset:gpio0 isp:n/a conn_led:gpio2 ser_led:n/a swap_uart:no

In my history it seems I used this command
Code:
avrdude -DV -patmega328p -Pnet:192.168.1.25:23 -carduino -b115200 -U  flash:w:brewpi-arduino-uno-revC-0_2_10.hex:i -C /usr/share/arduino/hardware/tools/avrdude.conf
 
There's always one more thing.

Have either of you with working ESP modules ever tried programming the BrewPi AVR firmware over the Wifi/Serial link using the BrewPi web gui?

I wanted to verify that the ESP with esp-link will support uploading new BrewPi AVR firmware, so I switched the ESP to "esp-01(AVR)" mode from the "esp-bridge" mode I've been using (that mode supports both CONN and SER LEDs, which definitely made debugging this a lot easier) then hooked up GPIO0 to the UNO RESET pin.

I verified that the reset function worked by whacking the UNO from the ESP web gui (handy feature on the uC Console page).
Then I grabbed the latest AVR firmware from Github and launched the Reprogram Arduino function from the BrewPi gui. Here's what happened:

Code:
**** Arduino Program script started ****
Settings will be restored if possible
Devices will be restored if possible
Nov 30 2015 21:53:54 Opening serial port
Checking old version before programming.
Checking current version: Found BrewPi v0.2.4, running commit 2a6f7f05 build 40, running on an Arduino Uno with a revC shield on port socket://192.168.1.230:23

Requesting old settings from Arduino...
Saved old settings to file settings-Nov-30-2015-21-54-02.json
Loading programming settings from board.txt
Checking hex file size with avr-size...
Program size: 26896 bytes out of max 32256
Nov 30 2015 21:54:04 Opening serial port
Programming Arduino with avrdude: /usr/share/arduino/hardware/tools/avrdude -F -e -p atmega328p -c arduino -b 115200 -P socket://192.168.1.230:23 -U flash:w:"brewpi-arduino-uno-revC-0_2_10.hex" -C /usr/share/arduino/hardware/tools/avrdude.conf
Result of invoking avrdude:
avrdude: ser_open(): can't open device "socket://192.168.1.230:23": No such file or directory
ioctl("TIOCMGET"): Inappropriate ioctl for device

avrdude done. Thank you.


There was an error while programming.
Nov 30 2015 21:54:04 New program uploaded to controller, script will restart
Nov 30 2015 21:54:10 Opening serial port
Nov 30 2015 21:54:10 Notification: Script started for beer 'RPINTS BrewPi4 Test7'
Nov 30 2015 21:54:20 Checking software version on controller... 
Nov 30 2015 21:54:20 Found BrewPi v0.2.4, running commit 2a6f7f05 build 40, running on an Arduino Uno with a revC shield on port socket://192.168.1.230:23

Sooo....aside from the 115200 baud rate specified by BrewPi (I'm running the ESP at 57600 as that's the original BrewPi firmware default for the UNO) it appears that avrdude doesn't know how to handle the port name for the ESP.

If the AVR code can't be loaded OTA it's nbd to me - that doesn't work over Bluetooth, either.
And I haven't updated the firmware for a year anyway (still running 0.2.4 as shown above).
But it would be that much cleaner if it did work through the gui.

I'll have to see if the suggested method shown on the ESP gui page can suffice...

Cheers!

I've used the esp to upload many a sketch wirelessly on other arduino projects. I've got custom vim hot keys that compile and upload them using avrdude. My projects all use the pro mini though which conveniently accepts new sketches at 57600 baud, I simply changed the brewpis call to avrdude to the correct baud... To upload to an uno requires 115200, I imagine all you would have to do is change the baud rate back and forth in the esp gui when needed.


(Edit) oops, dibbz beat me to it.
 
Thanks, guys. I followed your lead, had another shot of liquid courage, and went through the firmware update process:

- stop BrewPi script
- change ESP to 115200 baud (whacked the AVR with a RESET just for grins)
- set terminal focus to where the BrewPi hex file was located
- execute the avrdude command (identical to dibbz save for the ip address)

Here's what the terminal response was:

Code:
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "brewpi-arduino-uno-revC-0_2_10.hex"
avrdude: writing flash (26896 bytes):

Writing | ################################################## | 100% 11.11s

avrdude: 26896 bytes of flash written

avrdude: safemode: Fuses OK
ioctl("TIOCMGET"): Inappropriate ioctl for device

avrdude done.  Thank you.

Here's what BrewPi thought of the UNO once I switched the ESP back to 57600 baud and whacked it with another RESET and then restarted the script:

Code:
Nov 30 2015 23:53:03 Opening serial port
Nov 30 2015 23:53:03 Notification: Script started for beer 'RPINTS BrewPi4 Test7'
Nov 30 2015 23:53:13 Checking software version on controller... 
Nov 30 2015 23:53:13 Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port socket://192.168.1.230:23


Aside from the disconcerting ioctl errors, it seems to have worked just fine - and even preserved all of my settings (so, the eprom didn't get wiped during the firmware update).
That could be a problem should elco ever do a major release where he allocates eprom bits differently, but I'm guessing the odds of him doing anything major in this space are remote.

Anyway, my test minion is happily ticking along over Wifi, trying to change the temperature of my office without anything plugged in.
Must be frustrating for it ;)

I'll clean up my step-by-step and post it tomorrow for those that follow.

Thanks again to both of you folks!

Cheers! :mug:
 
I'm glad you got it working! How has it held up over the day? Also, what's the physical separation between your esp and wifi router?
 
I left it running that first night and into the next afternoon. At that point I was experimenting with different ESP configurations. I like the "Wifi-Link-12" option the best because I can run both the COMM and SER LEDs in that configuration making current state easy to see from across the room.

It also supports a uC reset, though the help page doesn't say if the logic behind that understands programmer activity (like the esp-01(AVR) claims.
But, practically speaking, if it didn't work to reflash an UNO with the BrewPi hex file it's no big deal to me.

I still need to do power-fail testing to see how robust the ESP solution is. My Bluetooth equipped minions never fail to automagically sync back up after power fails, so the ESP has to be that good to be useful to me.

So at this moment the only ESP I have running on BrewPi is the test bed in my office, which is also where my WAPs are located, so the distance is like 10 feet.

Ironically, the spacing between my trio of Bluetooth minions and their host RPi under my keezer is about 12 feet max. Otoh, a Wifi minion down there will have to talk to the WAPs about 30 feet a couple of walls and one floor above. So that's on the list of performance tests :)

Been making a couple of wiring diagrams - and translating my stream of consciousness system log into intelligible text before I fold it into this thread. Lots of distractions here lately though...

Cheers!
 
As threatened, I've cobbled together a soup-to-nuts procedure to outfit an Arduino running BrewPi (an UNO R3, in this case) with Wifi capability, replacing the USB tether.

Much of this is predicated on turning an esp-03 module into something actually useful. If one starts with a more robustly constructed esp module, a lot of that will have been done already.

And as far as I can tell, pretty near any esp8266 module can be made to work. Some need more bits and pieces added than others, and it's very important to know if a module comes with a 5V to 3.3V regulator (can't really do this easily without it), but otherwise it should work.

The forums have a 30 day expiration for editing your own posts so if anyone finds something that needs fixing let me know. After 30 days, I'll have to appeal to a higher authority, and ain't nobody got time for dat ;)



Wifi-Serial Module for BrewPi

Hardware needed:

- esp8266 module

I used an ESP-03 purchased from here: http://www.amazon.com/gp/product/B00OSWGA8M/?tag=skimlinks_replacement-20 for $7.80 delivered (Prime). This is a minimal ESP8266 implementation and lacks a 5V to 3.3V regulator, as well as header pins. As we'll be using this module on a 5V-based Arduino, a 3.3V supply has to be provided somewhere.

esp8266_vert.jpg

Alternatively, there are ESP8266 modules on the market with full IO breakout headers and integrated 5V to 3.3V regulators that can spare the need for soldering.

- FTDI USB-Serial Convertor Module

Genuine FTDI-chip module purchased from here: http://www.amazon.com/gp/product/B00HSX3CXE/?tag=skimlinks_replacement-20 for $6 delivered (Prime). Without this item, you'll need to come up with an alternative method to load the ESP8266 firmware needed to act as a transparent network-serial bridge.

ftdi32rl_pinout.jpg

- mini USB plug to USB A plug cable (to connect FTDI module to USB host)
- Dupont jumpers
- (2) 1K 1/8-1/4W axial lead resistors
- (1) 2K 1/8-1/4W axial lead resistor
- header
- the minimum number of pins needed is 7
- I cut up a header strip to make a 2x8 header

Optional:
- ld1117v33 fixed 3.3V output LDO regulator
- (2) 1uF 10V or higher capacitors
- 5VDC power supply (eg: wall-wart)
- LEDs for Power and CONN status
- 200-300 ohm resistors for LEDs


Firmware:

- esp-link
I used Release 1.0.4 available here: https://github.com/jeelabs/esp-link/releases/tag/v1.0.4
Download esp-link.tgz for the .5MB flash on ESP-03

- BrewPi AVR hex file: I've used both 0.2.4 and 0.2.10 successfully


Software:

FTDI driver:

- Drivers for FTDI adapters are available here: http://www.ftdichip.com/Drivers/VCP.htm
Specifically, I used the setup executable from here: http://www.ftdichip.com/Drivers/CDM/CDM v2.12.10 WHQL Certified.exe
Execute the file and it will install automagically.

ESP Flasher Utility:

- I used XTCOM_UTIL on Windows, zip file available here: https://drive.google.com/folderview?id=0B3dUKfqzZnlwRXBnV2NzUUNJUms&usp=drive_web
This just needs to be unzipped, then run the executable directly.

Terminal Emulator for Raspbian on Raspberry Pi (optional, for testing):

- I used Minicom
- Install minicon on RPi:
- $ sudo apt-get update
- $ sudo apt-get install minicom


Assumptions:

- Running Raspian Wheezy
- If using Jessie, references to the /var/www/brewpi folder change to /var/www/html/brewpi

- Arduino UNO R3 or equivalent up and running BrewPi on a USB port or Bluetooth module

- An available computer/tablet/phone with Wifi capability and a web browser


Wiring the ESP-03

For a minimal implementation, follow the wiring diagram below. Provide header connections for 5VDC, GND, RX, TX and RESET. Also, provide an extra GND header pin to allow connecting RESET/GPIO0 to GND for programming the ESP.

Note the resistor divider on the RX input. This shifts an incoming 5V-derived TX signal to a compatible level for the 3.3V RX input on the ESP8266, allowing safe connection to a 5V Arduino.

Also, I show a 1K pull-down resistor for GPIO15, but this can be omitted and a straight connection from GPIO15 to GND used instead. However, this would pre-empt using any of the ESP-Link modes that use GPIO15.

esp8266_wifi_serial_bridge_avr01.jpg

I built this module on a 2" x 1-1/8" piece of 100mil perf board. I provided three LEDs (for Power, CONN and SER status), and brought out all of the ESP8266 IO pins to the 18 pin header, along with extra GND pins and the inputs to the LEDs. This allows me to configure the module to use any of the ESP-Link modes by using Dupont jumpers.

As all of my UNOs are equipped with home-made LCD shields with provision to connect 3.3V Bluetooth Serial modules, they already have a level-shifter for the outbound TX signal, so I omitted that from my ESP boards.

esp_module_v2_horizontal.jpg

Flashing the ESP-03

- Be sure to move the jumper on the FTDI adapter to the "5V" position.

- Connect the ESP module to the FTDI adapter

ESP Module FTDI Module
VIN ------------- VCC
GND ------------- GND
RXD ------------- TXD
TXD ------------- RXD

- Jumper ESP-03 pins

CH_PD to 3.3V (hard-wired in schematic)
GPIO0 to GND (temporary jumper)
GPIO15 to 1K Pull Down or GND (hard-wired in schematic)

- Connect the FTDI adapter to a USB port on the system to be used to flash the ESP-03.

- Open Control Panel - Devices And Printers
- You should see device "FT232R USB UART"
- Right-click on the FT232R icon, select Properties
- Click the Hardware tab
- Check to see which USB Serial Port is being used (XTCOM_UTIL supports only COM ports 1-6).
- Click the list entry for USB "Serial Port"
- Click the Properties button
- Click the Port Settings tab
- Change the settings here to:
- Bits Per Second = 115200
- Data Bits = 8
- Parity = None
- Stop Bits = 1
- Flow Control = None
- Click the Advanced button
- Change the COM Port Number setting to COM1, COM2...or COM6.
- "OK" your way back up and out of the FT232R USB UART Properties dialog and back to the desktop.


- Launch XTCOM_UTIL.exe
- Click Tools - Config Device

xtcom_main_config.jpg

- Change COM No setting to the COM port you selected when configuring the FTDI adapter.
- Change Baud Rate to 115200
- Click the Open button
- A pop-up "Operation Succeeded" should appear.
- Click the OK button.
- Click the Connect button
- Should get a message indicating successful connection,
- Click the OK button, then dismiss the Conf Device page.

- Click API TEST - Flash Image Download

xtcom_main_api_test.jpg

- Browse to the location of the esp-link folder and select the boot_v1.4(b1).bin file
- Set the program Address Offset (hex): to 0x00000
- Click the DownLoad button
- should get an Operation Succeeded message
- Dismiss the Flash Image Download page.

[NOTE: I found I had to reboot the ESP to upload the second and third code blocks, thus the following steps]

- Momentarily disconnect the VCC connection to the ESP-03, then connect it again.

- Back in XTCOM_UTILITY, Click Tools - Config Device
- Make sure the COM port is set correctly
- Click the Open button
- A pop-up "Operation Succeeded" should appear.
- Click the OK button.
- Click the Connect button
- Should get a message indicating successful connection,
- Click the OK button, then dismiss the Conf Device page.

- Click API TEST - Flash Image Download
- Browse to the location of the esp-link folder and select the blank.bin file
- Set the program Address Offset (hex): to 0x7e000
- Click the DownLoad button
- should get an Operation Succeeded message
- Dismiss the Flash Image Download page.

- Momentarily disconnect the VCC connection to the ESP-03, then connect it again.

- Back in XTCOM_UTILITY, Click Tools - Config Device
- Make sure the COM port is set correctly
- Click the Open button
- A pop-up "Operation Succeeded" should appear.
- Click the OK button.
- Click the Connect button
- Should get a message indicating successful connection,
- Click the OK button, then dismiss the Conf Device page.
- Click API TEST - Flash Image Download
- Browse to the location of the esp-link folder and select the user1.bin file
- Set the program Address Offset (hex): to 0x01000
- Click the DownLoad button
- This file takes awhile to transfer
- should get an Operation Succeeded message
- Dismiss the Flash Image Download page.
- Exit the XTCOM_UTILITY

- Unplug the FTDI adapter from the USB host, and disconnect it from the ESP-03.
- Remove the jumper from ESP GPIO0 to GND


Initial ESP-03 Configuration

- On the ESP module, remove the GND connection to GPIO0.
- Connect power to the ESP-03.

- esp-link initially comes up with the ESP in Access Point mode.
- use a WiFi enabled host device (laptop, cell phone, etc) to find the ESP access point SID
- my ESP-03 came up as ESP-F3B019
- connect to the ESP access point
- launch a browser with url http://192.168.4.1/
- this brings up the esp-link home page

esplink_home_page.jpg

- Click on the Wifi button on the left edge of the page

esplink_wifi_page.jpg

- write down the Wifi MAC address (especially if you use MAC filtering on your WiFi Access Point(s))
- From the Wifi Association table, select the desired Network SSID
- Enter the Wifi Password for the selected WiFi access point
- Click the Connect! button
- note the Wifi State information to verify the ESP has connected and obtained a valid IP address
- Click the Switch to STA mode hot spot.

- Change the Special Settings to use a Static IP address
- Enable Static IP
- Enter the desired Static IP Adress (eg: 192.168.1.230)
- Enter the Net Mask (typically, 255.255.255.0)
- Enter the Gateway Address (the LAN address of your router) (eg: 192.168.1.251)
- Click the Change button.
- Verify the Wifi State information has been updated per the Static IP settings

- Click on the Home button
- note the Pin Assignment section. Here you can change how the ESP IO are used.
- esp-bridge:
- GPIO12 = hardware Reset output than can be used to reset the Arduino
- GPIO0 = CONN LED output (active LOW, connect LED anode to 3.3V)
- GPIO14 = SER LED output (active LOW, connect LED anode to 3.3V)
- GPIO13 = ISP

- esp-01 (AVR) RECOMMENDED
- GPIO0 = hardware Reset output than can be used to reset the Arduino
- GPIO2 = CONN LED output (active LOW, connect LED anode to 3.3V)

- wifi-link-12:
- GPIO0 = CONN LED output (active LOW, connect LED anode to 3.3V)
- GPIO1 = ISP
- GPIO2 = SER LED output (active LOW, connect LED anode to 3.3V)
- GPIO3 = hardware Reset output than can be used to reset the Arduino - GPIO13: connect to TX of microcontroller
- GPIO15: connect to RX of microcontroller


- CONN LED:
- Very short flash once a second: not connected to a network and running as AP+STA,
i.e. trying to connect to the configured network
- Very short flash once every two seconds: not connected to a network and running as AP-only
- Even on/off at 1HZ: connected to the configured network but no IP address (waiting on DHCP)
- Steady on with very short off every 3 seconds: connected to the configured network with an IP address
(esp-link shuts down its AP after 60 seconds)

- SER LED:
- SER LED will blink briefly every time serial data is sent or received by the esp-link.

- Click on the uC Console button at the left edge of the page

esplink_uc_console_page.jpg

- on this page you can change the ESP8266 serial port baud rate to match up with the target device
- when connected to an RPi, be sure to match the terminal emulator command with the baud rate setting
- I did my testing on the RPi at 115200 baud without issue
- when connected to an UNO running BrewPi, set the baud rate here to 57600.



Optional: Testing the ESP using an RPi

This procedure can use any ESP-Link mode other than wifi-link-12 (that mode uses different GPIO pins for RX/TX).

- Jumper ESP-03 pins
CH_PD 3.3V
GPIO15 1K Pull Down

- Wire ESP to Raspberry Pi
- ESP VCC to Raspberry Pi 5V
- ESP GND to Raspberry Pi GND
- ESP RXD to Raspberry Pi (GPIO14, Pin 8)
- ESP TXD to Raspberry Pi (GPIO15, Pin 10)

Raspberry-Pi-GPIO-Layout-Revision-2.jpg

- Power-up the ESP
- Power-up the Raspberry Pi

- Connect to the ESP network port
- using Putty, Telnet to IP Address:port 23 (eg: 192.168.1.230:23)
- Putty settings:
- Terminal
- disable Implicit CR every LF
- enable Implicit LF every CR
- Local echo = Force On
- Local line editing = Auto

- On Raspberry Pi, connect to serial port
- I use Putty from my Windows system to log into the R'Pi, then run minicom to connect to the serial port
- pi@raspi2 ~ $ minicom -b 115200 -o -D /dev/ttyAMA0

- Now you can type in either terminal session to push data back and forth



Connecting to Arduino UNO (R3)

- Jumper ESP-03 pins
CH_PD 3.3V (hard-wired in schematic)
GPIO15 1K Pull Down (hard-wired in schematic)

- Wire ESP module to Arduino UNO R3 (or BrewPi shield)
- ESP GND to Shield GND
- ESP VCC to Shield VCC (5V)
- ESP RXD to Shield TXD
- ESP TXD to Shield RXD
- GPIO0 to UNO RESET input (Optional: required for uploading new BrewPi firmware only)

- Change BrewPi settings:

NOTE: These edits are only valid for the latest version of the BrewPi host application.
I believe this is now the latest version found in the "legacy" branch.
I had to update from my existing installation which was over a year old.

/home/brewpi/brewpi4/BrewPiUtil.py
- Change
ser = serial.Serial(port, baudrate=baud_rate, timeout=time_out)
To
ser = serial.serial_for_url(port, baudrate=baud_rate, timeout=1)

/home/brewpi/brewpi4/brewpi.py
- Change
inWaiting = ser.inWaiting()
To
inWaiting = ser.readline()

- Change
newData = ser.read(inWaiting)
To
newData = inWaiting


/home/brewpi/brewpi4/settings/config.cfg
- Change
port = /dev/ttyACM0 (typical USB device ID for UNO)
To
port = socket://192.168.1.230:23 (ie: use your locally defined IP address with port 23)


Launch Chrome and load the BrewPi page, open the Log window, enable Auto refresh, then click Start Script.
You should see some lines in the log that look like this:

Nov 30 2015 23:53:03 Opening serial port
Nov 30 2015 23:53:03 Notification: Script started for beer 'RPINTS BrewPi4 Test7'
Nov 30 2015 23:53:13 Checking software version on controller...
Nov 30 2015 23:53:13 Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port socket://192.168.1.230:23


Programming Arduino with avrdude

avrdude does not recognize "socket://192.168.1.230:23" for a port definition, so you can't flash the BrewPi hex file directly from within the BrewPi gui.

Instead, open a terminal session and run avrdude manually using the following command format (note that this is a single long-assed command!)

Code:
$ sudo /usr/share/arduino/hardware/tools/avrdude -F -e -p atmega328p -c arduino -b 115200 -P net:192.168.1.230:23 -U flash:w:"brewpi-arduino-uno-revC-0_2_10.hex" -C /usr/share/arduino/hardware/tools/avrdude.conf

Be sure to use the full path to the hex file!


Cheers!
 
Last edited by a moderator:
Thanks! Hopefully someone will find it useful. If you could pour yourself a beer and walk through it as a sanity check some day that'd be great - a second pair of eyes is always helpful.

Ironically, I haven't done anything else with this since that first night I got a module running. The CES show in early January looms large and everyone wants fresh product designs done in time for "Show And Tell", so even while I'm sitting here typing I have simulation jobs running.

But after the holidays I intend to play with this esp thing a lot more to get a feel for how reliable it is (particularly power-fail recovery) and what its effective range is...

Cheers!

[edit] I suppose it's nit-picking (because who would do it?) but it occurs to me that - wrt security - there's nothing to keep someone who's on the LAN from opening a browser and slamming the UNO with a RESET or baud rate change or esp-link mode change or ip parameter change. Advantage Bluetooth: once BrewPi grabs a BT minion it's secure.
 
[edit] I suppose it's nit-picking (because who would do it?) but it occurs to me that - wrt security - there's nothing to keep someone who's on the LAN from opening a browser and slamming the UNO with a RESET or baud rate change or esp-link mode change or ip parameter change. Advantage Bluetooth: once BrewPi grabs a BT minion it's secure.

I'd say the bluetooth has the overall advantage because of how much less of a p.i.t.a it is to get going.
 
[edit] I suppose it's nit-picking (because who would do it?) but it occurs to me that - wrt security - there's nothing to keep someone who's on the LAN from opening a browser and slamming the UNO with a RESET or baud rate change or esp-link mode change or ip parameter change. Advantage Bluetooth: once BrewPi grabs a BT minion it's secure.

If someone is on your local network, they'd have much juicier targets to go after than messing with your arduino.
 
Not really. Every other device on my lan is password protected...

Cheers!

[edit] I'm thinking of curious guests, not someone with actual bad intentions...
 
fwiw, here's the schematic for my esp-03 perfboard adapter.
I'd have inserted it in my "How To" but there's a max of 10 attachments and I used them all...

esp8266_03_module.jpg

To reiterate what I wrote, this does not have the level shifter for the receive data circuit as I have that on my BrewPi shields...

Cheers!
 
With that SIL2102 UART-USB bridge chip on board, it's overkill for this application.
Also, if the lead pitch is 2mm getting Dupont connections on the header might be tricky.
That said - and with the caveat that my experience with the esp8266 is nascent at best to this point - I expect if you use the GPIO the way esp-link wants, it should work just fine...

Cheers!
 
To me, if it save you the trouble of having to solder the awkward esp itself and it has onboard power regulators I'd say its worth the extra $2
 
To me, if it save you the trouble of having to solder the awkward esp itself and it has onboard power regulators I'd say its worth the extra $2

I can't disagree. And a second look says the headers are 2.54mm pitch, so they'll take Dupont wires just fine...

Cheers!
 
Thanks for the replies. I'll look into that. I'm a way off yet, but getting my head around things
 
Code:
rm -rf /var/www/* && sudo -u www-data git clone https://github.com/BrewPi/brewpi-www /var/www

That could be a big ouchie for anyone running anything rooted in /var/www...

Cheers!
 
Yep, the Dockerfile is a set of instructions to create a docker image, which is a fully self contained "os" image.

You build that Dockerfile using docker, you cant run that script any other way.

I'm running it on my unraid nas, after all using wifi is so you dont have to waste good money on a RPi

http://lime-technology.com/docker-guide/
 
So I've screwed around with this docker thing, this you? https://hub.docker.com/r/quimnut/brewpi-wifi/

Anyway, this is some really interesting new fangled tech. One single command on the docker command line and 2 minutes later I have what appears to be a fully functioning brewpi-www running on a windows machine! (Goodbye raspberry pi)
 
Yep, in a nutshell make sure you run it with the 2 configuration items -e AVR=theip:port -e TZ=Australia/Brisbane as you might see I overwrite those lines in the config file and TZ in the cron when it's run. I should probably check to see if they are set first before overwriting them.

I'm mapping /home/brewpi/data and /var/www/data to local filsystems so I can delete the image and keep my historical data, not sure on the command line for that off the top of my head as on unraid I define this in a xml file so the web interface has all the settings;
https://github.com/quimnut/unraid-docker-templates/blob/master/quimnut/brewpi-wifi.xml
 
I just built a second arduino, same as my other but with an esp-12. Must say the esp-01 is easier with the simple pin header, less fiddling around, but ultimatly the same result.

I used esp-link 2.1.7 this time. Also managed to program brewpi-avr over wifi.

Then just another instance of the docker container with different port mapping and avr environment :)

Ordered one of these to try out becuase why not.
https://www.sparkfun.com/products/13287
 
Last edited:
With the sum of the parts and time spent to make an esp shield I think it's great value. Proto shield, 3.3v reg/caps/pin headers, esp8266, ttl logic would be > $10 inparts then to put it together and debug it. I also like how it has the full esp breakout, it takes most of the effort out of the build.

Clone arduinos are $5, sure the ch340 usb ttl is buggy and the cable is junk, but you dont need to use it in this application.

I will do a post on the shield when it arrives :)
 
Ah, I didn't realize the uno clones could be had for so cheap.
 
I've read of enough problems with really cheap Uno clones that I can't recommend that route.
Spend even ten minutes mucking with something that should have just plain worked and you're already in the red on the bargain....

Cheers!
 
Even though a lot of the electronics talk is over my head, this thread is very interesting.

My fermenter is in the garage and my keezer on the other side of the house. I have a brewpi made up that will run my fermenter and would love to add a wifi connected arduino to my keezer to control it's temps and get rid of my Johnson controller.
 
Even though a lot of the electronics talk is over my head, this thread is very interesting.

My fermenter is in the garage and my keezer on the other side of the house. I have a brewpi made up that will run my fermenter and would love to add a wifi connected arduino to my keezer to control it's temps and get rid of my Johnson controller.

A wireless brewpi would be a good option. If you havne't seen it already you might want to consider the bluetooth route as well, it's simpler to implement at this point.

https://www.homebrewtalk.com/showthread.php?t=508151#post6565042
 
Hi dibbz,
Great work with the docker image, it saved me countless hours. I was creating my own, and found yours before I got mine finished.

I just wanted to let you know I had some troubles because of pyserial 3. your Dockerfile checks out 0.3.8 tag which is using the pyserial 2 api, but "pip install pyserial" installs the latest (yep version 3 :) )

I have since been tweaking my own Dockerfile, and have it up and running using the legacy branch:
https://github.com/seeflat/brewpi-docker

I am having a problem though, was hoping someone had a suggestion. I am trying to configure devices and it just seems to never get anywhere, the log is filled with

Code:
...
Jan 17 2016 08:29:34 controller debug message: WARNING 1: Invalid command received by controller: 5
Jan 17 2016 08:29:35 controller debug message: WARNING 1: Invalid command received by controller: 0
Jan 17 2016 08:29:36 controller debug message: WARNING 1: Invalid command received by controller: r
Jan 17 2016 08:29:36 controller debug message: WARNING 1: Invalid command received by controller: e
...

there is a thread on the brewpi forum (https://community.brewpi.com/t/slow-serial-read-causing-profile-off-solved/862) indicating it is a slow serial read, which is what I suspect, but I have no idea how to fix it.
 
Nice work :) nginx was also on my list of things to do.

It would be debian jessies py version as it installs 2.7 on ubuntu 14. I check out the 3.8.0 tag so the patches will work if it changes. I choose that uid/guid as it matches the nobody user on my unraid nas where I run my containers.

My keezer is almost full so I was planning to do some more work to mine during fermenter downtime.
 
Back
Top