How To: BrewPi Over Bluetooth

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.
Day_tripper might have. But I've had no problems with the ones with buttons. Super easy to program.
 
Never ran into one with the button, but once I got the hc-05 and hc-06 both working I stopped looking for more/different styles...

Cheers!
 
Push button is nice. Hold down button, plug in power, enter uart mode.
 
Aside from 2.4ghz being rather unforgiving wrt attaching wires and stuff, wouldn't you also need to do the same to the host radio to see a benefit?

Cheers!
 
Just got a Bluetooth version running on the laptop. I need more minions now. View attachment ImageUploadedByHome Brew1430781305.898772.jpg thanks daytrippr for the write up and how to.
Works like a charm but metal roller door between shed containing the fermenters and the house back room seems to be blocking Bluetooth. So laptop is in shed also at the moment. Roller door up works. Roller door down doesn't work.
Might try extending the hc05 unit with some cat6 above the roller door.
 
Well, but...

This weekend I finally got around to re-unifying the SD cards on my two RPi2 "BrewPints" systems from a single clean image and when I got done the clone development/debug crate in my office booted up before I got down to my keezer to reinstall its card and fire it up.

Aaaand the office system grabbed all of the BT minions for itself. All of which are one story, two walls and ~30 feet away. Totally unexpected and confused me for a few minutes - I'm looking at each minion's radio and they were all happily connected, but not responding to their (expected) web pages.

So...while I wouldn't bank on Bluetooth working beyond a room away, it can surprise you with its range...

Cheers!
 
I've always been amazed at how a bluetooth headset in my left ear can lose connection from my phone in my right pocket
 
Just got more hc05 modules. Now have 2 of them humming away nicely. Thanks for all the work daytrippr and wbarber[emoji1]
 
Any thoughts on going wireless with one of these newfangled esp8266 wifi chips instead of the bluetooth?

I've been playing with them on different projects and have found them to have better range and reliability than my hc-05 projects. You would have to *slightly* modify the brewpi's python code to use a tcp socket rather than a serial port, I'm guessing that would be a simple patch.
 
Maybe. I've got one I haven't been able to get around to testing out. The difference that I see being an issue is timing. Where BT is a serial device and in a sense just acts exactly like having a usb cable connected without the wires. The esp is essentially the same thing. But why limit yourself to only using it for serial when it can host its own page. I was thinking of finding a way to hook it up to an stc-1000+. Then use the esp to log data and store programmable profiles for the stc while using brewpi to log the data it produces. But then why not just use brewpi. If only the esp had the code space of an uno you could just port the brewpi scripts over and build a lite ui for it and let it run the whole show.
 
Correct me if I'm wrong but it looks like the esp can take a user program of 248kb where as the arduino only takes up to 32kb programs. The avr code could at least presumably be ported to the esp as long as all you wanted was temp probes and just two relays (not enough IO for LCD). Then maybe we could skip the arduino/HC-05/BT dongle at least.

(I havn't written programs for the esp8266 yet, I've just been using it as a transparent wireless serial bridge for arduino projects as I needed the analog pins. https://github.com/jeelabs/esp-link/tree/master)

[Edit] Or there has got to be a simple way of just relaying tcp data to a /dev/serial port and maybe make the whole thing fairly seamless without modifying brewpi python scripts... Hmm...

Also something else to consider:
HC-05 + dongle >= $15
ESP ~= $4

[Edit 2] Hmmmm... tcp_serial_redirect.py just might be what I'm looking for.
 
Well yeah then go for it! I just assumed the esp was more like an attiny. Like I said I haven't even opend the package yet. You could presumably run the lcd on i2c. But I have no idea. And as far as price. Yeah the BT is more expensive. But I've been getting them for closer to 5 bucks.
 
All you really need is a dev listing to put into your config file I've run brewpi on ttyacm ttyusb rfcomm all different symlink names, so long as there is serial data going through it, at the right speed, it should work in theory.
 
All you really need is a dev listing to put into your config file I've run brewpi on ttyacm ttyusb rfcomm all different symlink names, so long as there is serial data going through it, at the right speed, it should work in theory.

I did a little digging, you can use the socat command to forward a tcp connection to a psuedo tty port:
Code:
socat -d -d pty,link=PSUEDO_TTY_PATH,raw,echo=0,waitslave tcp:IP_ADDRESS:PORT

Where:
IP_ADDRESS = the ip assigned to the esp8266
PORT = port the esp is using for serial bridge, probably = 23
PSUEDO_TTY_PATH = can be a /dev/ttyXX or even something like $HOME/dev/ttyTCP1, it can be whatever and doesn't have to be in the /dev directory. What you choose to do here might be dictated by permissions.

After you run that single command above you *should* be able to just point the brewpi scripts to PSUEDO_TTY_PATH and go on like normal. Now I just need to work out the *proper* way to get that command to run automatically when the computer/rpi boots.

References:
http://unix.stackexchange.com/questions/100845/serial-data-over-ethernet-on-a-linux-box?rq=1
http://unix.stackexchange.com/quest...-remote-serial-over-tcp-ip-as-dev-ttyx-device
 
Hmmm. With bluetooth we've learned to basically bind a specific rfcomm port to each device by MAC address. The ports are really only active when Python fires up the script looking for the arduino. And since brewpi will continue to check and restart the script if it gets disconnected, this makes it a very reliable way to connect to our minions. If you dig through the brewpi over Bluetooth thread you may find some relevant details that could be ported over to your setup to help with the connection at startup.
 
Okay, for everyones future reference... to get a wireless link to your avr via wifi (via esp8266) you have 2 theoretical approaches:

  1. Create a psuedo tty serial device as described above. You'll need to hassle with making automatically initialize with the upstart daemon.
  2. Change 2 lines of code in brewpi-script/BrewPiUtil.py:

    On lines 118 and 123 change this
    serial.Serial(port, ...​
    to this
    serial.serial_for_url('socket://IP_ADDRESS:pORT', ...​

I like option 2, it's simpler. Option 1 is slightly involved. I'll give it a test run tonight and report back.

(And I'll stop hijacking this thread now. if it works, and people are interested, I'll do a new write up)
 
I'd love to start using esp's for the ferment chambers that'll be outside. Thanks for putting in the time.
 
[...] (And I'll stop hijacking this thread now. if it works, and people are interested, I'll do a new write up)

I've been enjoying watching this wifi thing evolve and not only welcome the discussion, it's nice not to be the driver for a change ;)

That said, if you do get this working - and automatically reconnecting after a full power cycle of host and wifi minion - a separate "How To:" thread would be a fine idea going forward for a lot of good reasons.

And to that eventual end: detail counts.
A full step-by-step will go a long way towards avoiding a whole lot of "It doesn't work" posts :drunk:

I don't have a compelling need for this - yet. My BT minions work perfectly, likely due to all of them being nearly within arms reach of the RPi2 host - and they all come right back up without missing a beat after a power fail (love the auto-connect stuff, it's darned near magic :))

But assuming the esp8266 works with BrewPi I'll definitely pick one up to play with. I have a spare BT minion with all the trappings running BrewPi on my desk just for testing stuff that I can switch to a wifi version and see what's up...

Cheers! :mug:
 
It works! I went with option 2 from post 226.
Mxcgex9.png


All I did was tweak two lines in one brewpi-script file and it's running:
OwAPvoJ.png

[edit] this is a hack, there is probably a more appropriate way to do this. suggestions? [/edit]

So that's all there is to it on the brewpi side of things. After that continue on as normal.

It's the firmware flashing and setup of the esp8266 that takes more work. I'll let this run for a while before I do a write up. How would y'all suggest I record and test for stability?

Here is a pic of my breadboard spaghetti:
0abG569.jpg


That is a cheapo chinese $3 arduino pro mini (5v) and a esp8266 (variant 3). The jumble of wires on the left edge of the breadboard is the lm317 3.3v power supply. The junk in the bottom right area of the board are couple bare ds18b20 temp sensors.

(Also fyi, I flashed this arduino wirelessly from the brewpi maintenance panel. I know that was something we had trouble with on the hc-05. However I did have to edit another python file to make that work.)
 
What file did u modify

The edits shown were in BrewPiUtil.py

To get the hex to upload over network I modified the call to avrdude in programArduino.py. Avrdude supports uploading over tcp so all you have to do is change the port parameter from a local /dev device to an ip address (like this -P/dev/USB0 to -Pnet:192.168.1.88:23) and make sure the baud rate is correct for what ever kind of arduino you're using.
 
I'm off to put a order in for more widgets. [emoji12]

!!!Disclosure!!!
Before anyone gets too excited I had some problems last night. I let it run through the night and it *mostly* worked. I'm getting some JSON errors every once in a while and there were a couple strange 15 minute stretches that the rpi didn't receive any data at all from the minion... I'm working on it. I'm also working on a 'development' thread that I will link back here when I post it.
 
I was banging my head against the wall with no responses from my HC-05 while trying to set it in the AT mode with Arduino Serial Monitor.

My module was in slow blink mode. I just wasn't getting any response.

Google turned up this:

One IMPORTANT thing, Newline feed (\n) and Carriage return (\r) are needed on every AT command entered. So if you're using Arduino's serial monitor make sure you select "Both NL and CR" on the dropdown.

I may have missed it but I didn't see it posted here...
 
Yes it's in there somewhere. Also if you are using the kind with the button on it. You need to hold down the button when entering commands if you want them all to return a response.
 
!!!Disclosure!!!
Before anyone gets too excited I had some problems last night. I let it run through the night and it *mostly* worked. I'm getting some JSON errors every once in a while and there were a couple strange 15 minute stretches that the rpi didn't receive any data at all from the minion... I'm working on it. I'm also working on a 'development' thread that I will link back here when I post it.

Any progress on the "mostly worked" thing?

Cheers!
 
Any progress on the "mostly worked" thing?

Cheers!

After the first night it ran pretty smoothly for a week. I've since had to stop this project to refocus my efforts (and fermentation fridge components) toward getting a couple batches ready for a party in August. I will come back to this in the next few weeks. Also, I'll post something tomorrow to explain where I'm at.
 
After the first night it ran pretty smoothly for a week. I've since had to stop this project to refocus my efforts (and fermentation fridge components) toward getting a couple batches ready for a party in August. I will come back to this in the next few weeks. Also, I'll post something tomorrow to explain where I'm at.

any news on this project? I fell in love with these esp8266s so I want to give it a try
 
Back
Top