# ESP32 Tilt Repeater



## N3MIS15 (20/10/19)

I wrote a small sketch that repeats the data sent from any tilts it finds. My Tiltpi logging data while brewing in stainless fermenters that are inside fridges has proven difficult. The ESP32 repeater seems to have solved my issue. I have placed one inside each of my 3 fridges (outside of the fermenter).

The official repeater is about $130 AUD and can only repeat 1 tilt at a time AFAIK. My "solution" can be cobbled together for less than $10 and repeat all Tilts within range. It is most definitely not as low energy however.

The code can be found at https://gist.github.com/N3MIS15/72658a024eb0dfde6d1c0958092acd42

'I would love some feedback from anyone who is willing to give it a shot.

Cheers,
Davo.


----------



## N3MIS15 (27/10/19)

FWIW this is the output from serial while connected to my phone. 5 Bluetooth devices were found and 3 were recognized as Tilt hydrometers. The green tilt is in some cleaning solution so ignore its temp and gravity.


----------



## scooterism (25/11/19)

I don't know what it is or what it does or how to do it.

But I am looking for a way to boost the signal from my Ispindle to my wireless network.
I have an old router or two but I have no idea how to turn them into wifi extenders
I could by a wifi extender but they seem a little pricey
Can I trust the $20 extenders of ebay?


----------



## N3MIS15 (25/11/19)

This repeater is for Bluetooth, the Tilt specifically. 
Wifi repeaters are pretty common, Google openwrt. It's an open source router firmware. If you get lucky 1 of your old routers will support it. Openwrt can pretty easily be configured to turn routers into repeaters. Compatible routers can also be found cheap online.

Cheers.


----------



## AussieBarry (15/1/20)

N3MIS15 said:


> 'I would love some feedback from anyone who is willing to give it a shot.
> 
> Cheers,
> Davo.



Hi Davo,

Congratulations on a nice piece of coding.
My Tilt hydrometers should be delivered today but I am not sure of their range straight out of the box.
I have ordered a couple of ESP32s and hope to get them soon.
(I have played with ESP8266 modules before but not the amped-up versions.)
Once I have all the pieces of the jigsaw, I will let you know how the system performs.

Cheers
Barry


----------



## postmaster (27/3/20)

N3MIS15 said:


> I wrote a small sketch that repeats the data sent from any tilts it finds. My Tiltpi logging data while brewing in stainless fermenters that are inside fridges has proven difficult. The ESP32 repeater seems to have solved my issue. I have placed one inside each of my 3 fridges (outside of the fermenter).
> 
> The official repeater is about $130 AUD and can only repeat 1 tilt at a time AFAIK. My "solution" can be cobbled together for less than $10 and repeat all Tilts within range. It is most definitely not as low energy however.
> 
> ...



Hi Davo
Did not realise that you had posted the tilt repeater on this site.
You send me am email in response. thank you. (On Github)
I am actually using a HDMI monitor and the code I put in on the tilt program that I have loaded on the Raspberry Pi Zero W is
max_usb_current=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 1024 600 60 6 0 0 0

I don't have any trouble with the Pi, tilt, and the HDMI screen as it displays what I need.
Its just that I have 2 fridges and one is a bit far away with a solid SS fermenter and its a freezer so its a bit more insulated, so if I want to get a reading I have to leave the door open and the top undone.
(which defeats the purpose)
Utuber "HarryBrew69" seemed to get it working. Tried to contact him, but not luck.
David Haig from the Tilt Hydrometer user group said that he has successfully use a usb dongle from the Tilt.
I purchased one and ran it from the power mini usb port on the Tilt, no luck again. (This bluetooth dongle CSR 4.0 and is suppose to work on the tilt) (I suppose with code)
I not even sure what I am doing anymore.
Might have to bite the bullet and pay out $130 for a repeater.
ps Any 


help much appreciated
Cheers

John


----------



## N3MIS15 (28/3/20)

I have a similar setup. 2 separate fridges both with stainless fermenters.
I have an esp32 inside each fridge powered via a phone charger. I currently don't use tiltpi as logging is not my thing, but I have in the past. I would suggest trying to locate the bluetooth dongle somewhere between the fridges. I can confirm the CSR 4 .0 dongles work and do make it much easier to get a signal than the built in antenna on the pi.

I will explain exactly what the esp32 is doing with the default settings to give you an understanding of parameters that could be changed to possibly give better results.

The esp32 scans for bluetooth devices for a period of time determined by the "SCAN_TIME" variable. By default this is 5 seconds. Increasing the "SCAN_TIME" variable will give the esp32 a better chance of finding bluetooth devices with a weak signal.

The esp32 then goes through all the bluetooth devices is found and filters out any that are not Tilt hydrometers. If any Tilts are found, the esp32 checks if they are the desired colour to repeat (determined by the "repeatColour" variable, 0 being all colours). It then takes that information the Tilt sent and repeats it. After repeating the esp32 goes to sleep for an amount of time, which is determined by the "TIME_TO_SLEEP" variable. The esp resets at this point and starts this sequence of events all over again.

If no Tilts are found by the scan, the "TIME_TO_SLEEP" variable gets divided by the "fastSleep" variable (with the default settings the result would be 15). This forces the esp32 to scan more often when no tilts are found by the scan.

This behavior is very similar to how the official tilt repeater works. I dont have any experience with the official repeater, but the source code is available online.

In your situation I would suggest increasing the "SCAN_TIME" and decreasing the "TIME_TO_SLEEP" variables.

Hope this helps,
Cheers.


----------



## postmaster (28/3/20)

N3MIS15 said:


> I wrote a small sketch that repeats the data sent from any tilts it finds. My Tiltpi logging data while brewing in stainless fermenters that are inside fridges has proven difficult. The ESP32 repeater seems to have solved my issue. I have placed one inside each of my 3 fridges (outside of the fermenter).
> 
> The official repeater is about $130 AUD and can only repeat 1 tilt at a time AFAIK. My "solution" can be cobbled together for less than $10 and repeat all Tilts within range. It is most definitely not as low energy however.
> 
> ...





N3MIS15 said:


> I have a similar setup. 2 separate fridges both with stainless fermenters.
> I have an esp32 inside each fridge powered via a phone charger. I currently don't use tiltpi as logging is not my thing, but I have in the past. I would suggest trying to locate the bluetooth dongle somewhere between the fridges. I can confirm the CSR 4 .0 dongles work and do make it much easier to get a signal than the built in antenna on the pi.
> 
> I will explain exactly what the esp32 is doing with the default settings to give you an understanding of parameters that could be changed to possibly give better results.
> ...


Davo,
Thanks very much for your time. This is the result.
Anyway good news. I feel bloody stupid.
I flashed the esp32 that many times its a wonder it did not give up the ghost. I Flashed it with one of the samples and had a BLE scanner on my phone and low and behold it came up before I unplugged it from the computer (Would not do that with the power pak)
The little book converters for the power LM2596 you can regulate the volts (I was just using any old Power Pak from a phone etc 6 volts via the LM2596 set at 3.95 volts)
To get to the solution I had the converters running a 3.95 volts (What HarryBrew69) said to do.
Once I powered it up to 5 volts they both worked. Looks like they are very sensitive to a voltage.
Bloody Hurrah.
I actually don't log to the google page or whatever it is. I just like the visual aspect when I go into the shed and brew room to see whats happening.
I think its beyond me to get the CSR 4 .0 dongle to work .
Anyway I am very happy at the moment.
Congratulations on a fantastic GItHub program

Cheers and stay safe


----------



## postmaster (8/5/20)

N3MIS15 said:


> I have a similar setup. 2 separate fridges both with stainless fermenters.
> I have an esp32 inside each fridge powered via a phone charger. I currently don't use tiltpi as logging is not my thing, but I have in the past. I would suggest trying to locate the bluetooth dongle somewhere between the fridges. I can confirm the CSR 4 .0 dongles work and do make it much easier to get a signal than the built in antenna on the pi.
> 
> I will explain exactly what the esp32 is doing with the default settings to give you an understanding of parameters that could be changed to possibly give better results.
> ...


Hi Davo, I did have trouble on the ESP32 dropping out and increased the scan time to 15 and decreased Time to Sleep to 30 working fantastic tks


----------



## GavinM (21/7/20)

N3MIS15 said:


> I wrote a small sketch that repeats the data sent from any tilts it finds. My Tiltpi logging data while brewing in stainless fermenters that are inside fridges has proven difficult. The ESP32 repeater seems to have solved my issue. I have placed one inside each of my 3 fridges (outside of the fermenter).
> 
> The official repeater is about $130 AUD and can only repeat 1 tilt at a time AFAIK. My "solution" can be cobbled together for less than $10 and repeat all Tilts within range. It is most definitely not as low energy however.
> 
> ...


Thanks Dave for a great sketch! It worked perfectly and saved me some $ by not having to buy a Tilt repeater. The ESP32's antenna Tx range is far superior to the Tilt, and its Rx is also way better than that of my iPhoneX

Quick question: How long do you think I can run the ESP32 from a 3V lithium battery connected directly to the +3V pin? I'm using it with a RaspPi running TiltPi which reports every 15 min to my brewing software. Would you suggest lowering SCAN_TIME or increasing TIME_TO_SLEEP to reduce power consumption?

Thanks from across the globe in Los Angeles!


----------



## N3MIS15 (22/7/20)

GavinM said:


> Thanks Dave for a great sketch! It worked perfectly and saved me some $ by not having to buy a Tilt repeater. The ESP32's antenna Tx range is far superior to the Tilt, and its Rx is also way better than that of my iPhoneX
> 
> Quick question: How long do you think I can run the ESP32 from a 3V lithium battery connected directly to the +3V pin? I'm using it with a RaspPi running TiltPi which reports every 15 min to my brewing software. Would you suggest lowering SCAN_TIME or increasing TIME_TO_SLEEP to reduce power consumption?
> 
> Thanks from across the globe in Los Angeles!


Hey mate, glad it's working for you.
I have not done any testing with battery life, but yes adjusting those values should increase it. The default of 1 minute is overkill. 
There are also values further in the code that change how much power the Bluetooth antenna gets. If you think you can get away using less power it makes sense to drop them. By default the esp uses a antenna power of 3. I have it set to 9 to maximize chances of finding the tilt. I really should move those in to the user settings, but for now you can look at lines 188 & 189 to adjust the scan antenna power and lines 165 & 166 for the repeat antenna power. 

Cheers, 
David.


----------

