more G-Labs products

Author Topic: Esp8266  (Read 4955 times)

February 03, 2016, 09:18:04 AM
Read 4955 times

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
Anybody using these?  I'm planning on  ds18b20 and a relay or two via mqtt back to homegenie. Got it on the bench talking via at commands now need to look at nodemcu

February 03, 2016, 12:51:36 PM
Reply #1

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
I have been using the ESP8266 as a garage door / multisensor for over 6 months.  Works great if you enjoy tinkering with arduino/electronics and a bit of code, but don't want your device in a pretty white box ;-)  More info in this thread...
http://www.homegenie.it/forum/index.php?topic=927.msg5664#msg5664

February 03, 2016, 03:37:05 PM
Reply #2

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
Thanks, thought I had seen stuff floating about, but couldn't find it with the search!

Dont mind playing with electronics.. My view is to use a fair few of these esp modules with some custom pcb's to try and enable some existing stuff where I cant get wires and don't want big 'smart' devices with limited functionality.

What language / firmware have you been using.. I have the ESP-12 modules here.

February 03, 2016, 04:10:26 PM
Reply #3

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330

February 03, 2016, 04:53:47 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I'm attempting to convert my 433MHz sensor receiver to MQTT gateway from Arduino UNO over to a NodeMCU + RFM69.

I'm slowly making progress, but I find that the documentation on using these things with Arduino IDE is TERRIBLE.  I spent quite a while over the last couple days trying to figure out why using things like BUILTIN_LED doesn't work.  Turns out that the IDE doesn't pick the right GPIO for my board.  This seems common with my Wemos D1 as well.  But, if you reference the GPIO number directly, it will work.  The issue is, the board is labeled with an Arduino type pin number (D0, D1, D2, ...) and not the GPIO (0, 1, 2, ...) and since they don't align (D0 <> GPIO 0) it is tricky.

The other thing I've run into is that the libraries for Arduino hardware are not always compatible with ESP8266 modules.  So, the RFM69 library that everybody uses:
https://github.com/LowPowerLab/RFM69
Does not work for ESP8266.  I've read a couple blog posts that suggest a port has been completed, but it appears none have been released.  I assume this won't be an issue for your ds18b20 as it's quite common hardware.

February 04, 2016, 12:17:54 AM
Reply #5

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
I've just got a esp-12 and noticed that gpio names  ref a gpio index number.  I've flashed a node mcu firmware on,  but the more I read the more confusion about what to run on it.. People say not to use arduino but got to be better than Lua?

February 04, 2016, 02:56:47 AM
Reply #6

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
I vote for arduino unless you happen to know Lua scripting.

February 04, 2016, 01:59:23 PM
Reply #7

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
I'm sticking with arduino.

Just writing some code up now using notepad with a view to flashing the code when at home :)

Plan is to communicate via mqtt and be able to control the frequency of updates by sending commands, IE tell it to send temp more or less frequently without code changes.. and then also send back ack messages for when you tell it to do something.. so I actually know I have turned a module on.. and also support local switching that gets sent back to home genie to update the module state.


February 06, 2016, 12:53:21 AM
Reply #8

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
Got the thing sending messages via mqtt now.. Just using mosquitto for testing initially :)

Image attached

February 06, 2016, 04:59:02 AM
Reply #9

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I've been having a heck of a time trying to get a simple test going with my NodeMCU or Wemos D1 boards.  I can run all the basic stuff, but when I hook up a RF receiver module, I get resets every 5 seconds. 

February 06, 2016, 01:56:37 PM
Reply #10

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
What you using for power? (I know every one says this for every pi problem too!!!)

I did have interesting behavior last night, when I tried to get the signal strength it crashed the thing.. so skipped that for the moment.

What sort of RF Receiver you using too? just a 433mhz am?? if so I have a load here I can test with if thats any use.. EDIT- Just seen RFM69..

Depending on what board you are using some have the gpio's marked incorrectly.

Anyway got a little further with mine now as it can detect multiple sensors and post these via MQTT.. just need to work out how I am going to store the previous values for multiple sensors..

Reading this http://blog.hekkers.net/2012/09/18/mqtt-about-dumb-sensors-topics-and-clean-code/ was very interesting, so going to use the MAC address to pull data required, which I currently post to a topic during setup()

but going to need to do some dev on the homegenie side to store / retrieve this data, probably in a db initially.

David

February 07, 2016, 07:33:30 AM
Reply #11

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I have a couple hardware configurations I've been playing with.
  • NodeMCUv3 + SRX882
  • Wemos D1 + RXB6 (3400 chipset)

I actually just got them working to some degree this afternoon.  I can now receive noise (no signals yet).  I plan to use the RFM69 in the end, but the ESP library for RFM69 is not published so far as I've found.  I think I can use the chip without the library, but it will be missing most of the benefits.

February 13, 2016, 01:22:46 PM
Reply #12

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
Think I have almost finished the code on the 8266 now..

Basic functionality:

Scan for the number of sensors attached (DS18B20) (currently only using two.. as coding for one seems silly :) )

Posts signal strength and temp when changed via MQTT to dynamically determined topics using the devices macaddress.

Receives commands to control a relay via MQTT to do the following:

ON
OFF
STATUS
FLASH_ON (will revert to previous state)
FLASH_OFF

All commands can send an ack msg back when received too.

Going to also add a local switch that could be used in the room to turn the light on, which would then tell homegenie the state, this should allow things to work whilst homegenie reboots or is offline for any reason :)


February 15, 2016, 06:13:14 PM
Reply #13

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
So can I assume you are using the ESP as the sensor nodes and they send the data to your MQTT broker for collection?  Have you looked at power usage yet?  I read that ESP was a power hog compared to an Arduino + RFM69 or Arduino + nRF24L01+.  My setup won't have remote sensors as I'm simply collecting commercial 433MHz signals and processing them in my gateway and then sending the processed data on to my MQTT broker via 2.4GHz.

Oh, and I've found a number of resources that appear to all point to the MySensors RFM69 library which now has ESP support within the Arduino IDE.  I haven't gotten a chance to play with it yet, but hopefully it will work out.

February 17, 2016, 01:57:24 PM
Reply #14

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
From here ... http://blog.hekkers.net/2015/04/06/esp8266-good-enough-for-a-battery-powered-sensor/

Quote
A report interval of 4 samples per hour will lead to a battery life of roughly 1 year. Increasing the report interval to 60 times an hour (once per minute) will lead to a much shorter battery life: less than 3 weeks.