I have boxes of SBC and MCU units bought with the best intentions but not used. However, another should be arriving in the post soon (Pitaya Go) and I’m hoping I’ll be able to get my finger out and figure out how to whip up a device to read from my fitness kit and then output to MQTT.
In our house all the automation devices talk to the MQTT broker and just about anything can be done, usually with NodeRed.
My intention is to control the fan speed from heart rate. Yes, I know there are other options and projects for doing this but that’s just the first possibility. As my pain cave is on the far side of the house and upstairs away from other humans and I’m overweight and unfit I will probably set it to flash all the lights in the house, turn off the telly and announce on all the Alexa units “heart attack in progress” if my HR drops to zero or goes above 200 with the bike speed/cadence at zero.
I could also log all data to a database as well as ambient temperature, humidity and so on.
I’m not aware of any way. I think ANT dongles get dedicated to a piece of software so you’d need a second. Not sure about bluetooth. I’ve resorted to having 2 fans controlled by Sonoff devices. The chip in them is very common and you can flash them with loads of different firmwares. You can then connect to MQTT. This facilitated timers and being able to turn on using your phone.
An easy option would also be attaching a temperature sensor to a bottom bracket or trainer and using threshold(s) to turn on the fans.
If you attached a Sonoff TH1 with a temperature sensor to the trainer you could use it to start the Sonoff Basic controlled fans without any messing about with firmware by creating a ‘scene’ in their app. That might be easiest.
I like to geek as much as the next guy but i suspect your thinking is flawed.
Unless you’ve built a wind tunnel you should be giving yourself maximum cooling from the outset, your heart rate will rise from effort anyway , why confuse that by factoring in the increased effort and heart rate from insufficient cooling and then reactively increase the cooling?
It sounds detrimental to the principle of getting faster
I don’t understand where the wind tunnel comes in but an increase in heart rate is not just about getting blood to the lungs and muscles but also about getting blood to the skin for cooling. On my workouts my HR is low during the warm-up and at it’s highest on the last interval and I usually knock the fan speed up from minimum to maximum over the workout. I haven’t analysed the reasoning that’s just what works for me. However, that whole discussion is an aside because you can link the fan speed to any metric you want! Speed, power, HR average over a period. Is the Wahoo wind or whatever linked to speed?
Someone, who is way more capable than I, already has a fan specific device in development. https://maelstrom.me/
In fact, the concept of what I’m looking is even more general and needn’t even involve the fan.
It’s more about getting ANT+ or BTLE to MQTT. If nothing else, you could have a database record of all activity in your gym and the ability to report off that.
A really simple example. Put a WiFi device on the socket to your smart trainer (Shelly/Sonoff circa £10) and then have it power up whenever you put on your HR strap and then power down 5 minutes after you take off the HR strap. Have the lights in your pain cave turn off 10 minutes after all ANT+ signals stop.
One simple option is probably a Raspberry Pi, Ant+ USB stick and this python library and example:
The library is a bit of a mess from what I remember, but it did work for the most part. The example is a bit cryptic unless you are familiar with Ant+ specs. If you want to delve deep into ant+ world, all the specs can be found from https://www.thisisant.com/ you just have to register and accept a bunch of slightly disturbing license agreements.
A new Raspberry Pi with BLE support and implementing something using the bluez stack might work? I haven’t tried it but there are some examples like this behind google:
For truly embedded Ant+/BLE development I’ve personally done some fun projects using NRF52832 chips. Plenty of examples for connecting to and pretending to be various BLE/Ant+ HR devices. The chip doesn’t have wifi/ethernet though so it doesn’t suit your needs of being able to push stuff to MQTT.
Maybe it exists now but when I last looked there was a lot of work.
The Sonoff devices usually have one free input and the chip can be programmed from within the Arduino IDE. I think I’d add ANT that way if I could be bothered. Bluetooth is encrypted and many devices only allow one to one pairing. Sniffing the ANT signal would be easier.
I’ve been thinking and tinkering along similar lines - been fairly time constrained of late.
My thought was having a set of neo pixels in the garage that change colour depending on how hard I’m working :-). I was initially thinking of driving them with an Arduino via ANT+ (for the same reasons as previously mentioned, I can piggy back off the existing sensors).
Couldn’t find any Arduino based ANT+ info, so I switched to Raspberry Pi for the sensor reading (I’ve already got a Raspberry Pi in the garage running a touch screen in the garage).
I’ve got it as far as reading HRM data via some Node (Python lib’s seemed pretty horrible and wouldn’t work reliably for me) - I was thinking of connecting the Pi to the Arduino via BLE, but then realised I was massively overthinking it and I’ll probably hook it up to the NeoPixels via a FadeCandy (mostly because I have one kicking around and it’s just a USB connection to the Pi and fairly simple to control from Node as well).
Time is my main problem - work has been pretty busy of late and I’ve not had the brain capacity to sit and code on a weekend !
Been around the houses with reading the ANT+ as I said in my previous post, I couldn’t initially get the Python libs to work, so switched to Node - couldn’t really get on with Node so thought I might give a C++ driver a whirl, couldn’t get that to compile on the PI so I went back to python and found some more on-line stuff and hey presto I can read reliably from ANT+.
Currently it’s configured to just read any HRM that is close enough, I’ve got a Wahoo TICKR, and use an Amazon fire tablet for Trainer Road which basically means it’s using both BLE and ANT+ at the same time. Messages getting dropped onto the MQTT queue (I’m running Mosquito on another Pi).
I diverted from the fade candy, just because the cabling was going to get silly (the LED’s are in the garage roof), I could have put a Pi Zero up there, but I want to be able to turn it on and off simply (and pulling the power on Pi is not always safe), so back to the Arduino idea to see if I could get a Wifi enabled one, and if there are libraries for reading MQTT.
Of course there are
Bit more coding later, and I’ve got a basic setup using an Adafruit M0 Wifi Feather, with the PXL8 FeatherWing to drive the Neopixels. I’m using a library called FastLED to do the LED patterns.
Its’ nice and easy to test because I can drop a message on the queue to switch the LED patterns.
At the moment it’s all HRM based, but if I’m understanding the ANT+ library correctly it’s fairly easy to target other device types and then relay the data out.
I’ll try and write it up a bit better in the next few days, with some videos of the LED’s reacting to changes, but I’ve achieved what I wanted to - something simple that I can just turn on at the mains from the LED side of things, and not have to run any commands on a pi to start it up.