balonchiks
Posts: 7
Joined: Thu Apr 06, 2017 12:36 pm

Read and send sensor (bme280/dht22) data via bluetooth to Pi

Thu Apr 06, 2017 12:43 pm

Hi guys, i'm quite a noob with raspberry pi at the moment. So far only managed to connect the bme280 sensor via GPIO and setup a cron to reread sensor info every 'x' minutes and store it in domoticz. Could please someone guide me on how to connect a bme280 sensor to a bluetooth module (hc-05 let's say) and read data by raspberry from the sensor via bluetooth? as far as i understand, i would need something like an arduino nano on the sensor end? I am trying to monitor weather data outside and do not want any wires to come from my raspberry. Maybe some of you did a project like that and/or have a link to share with description? thank you all in advance.

timrowledge
Posts: 1348
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Read and send sensor (bme280/dht22) data via bluetooth t

Thu Apr 06, 2017 4:34 pm

Get an ESP8266 module - I've been using both the cheap clones and real versions of the WeMo mini D1& pro models - and load up the Arduino IDE with the required support. See AdaFruit's site for lots of very good doc.

Then grab the libraries for mqtt and BME/P support, hack the demo program a little and you're done; well aside from making a box to protect it outdoors.

On the Pi, apt-get install mosquitto to load up the MQTT broker. There's a ton of decent tutorials around the web for this. They must be good - I understood enough to survive the horror of using both Python and Arduino C++ well enough to be able to write my own MQTT client in a proper language.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Read and send sensor (bme280/dht22) data via bluetooth t

Thu Apr 06, 2017 4:45 pm

It could be done via an HC-05 and a microcontroller of some sort: an Arduino Nano or even an ATTiny85. A WiFi solution, as mentioned above, would probably give you better range and flexibility, especially if you already have a WiFi network. You'll need to make the Pi an Access Point, if not.

balonchiks
Posts: 7
Joined: Thu Apr 06, 2017 12:36 pm

Re: Read and send sensor (bme280/dht22) data via bluetooth t

Thu Apr 06, 2017 6:05 pm

thank you guys. ordered myself a hc-06 and arduino nano. will try to do it this way. will also try to figure out how to power the whole thing and then how to programm the arduino. thanks again.

Return to “Beginners”