AM2315@NodeMCU

AM2315The AM2315 is a temperature & humidity sensor with an I2C-interface in a nice enclosed style. The sensor contains a DS18B20 temperature sensor and a capacitive humidity sensor. A microcontroller inside builds the sensor interface and works as an I2C-slave.

For outside measurements it is also advantageous that the AM2315 comes in a rugged case with mounting bracket. While it is not rated as ‘weatherproof’, it is more suitable than SHT PCB-breakout sensors for measuring outside.

After crimping a Grove-connector we can connect this sensor to a Grove Arduino sheld hooked on a Wemos D1 board, for example. Or you connect the wires to a Wemos D1 mini.

AM2315-Grove

At Github you will find an AM2315 Lua module and it is easy to integrate the AM2315 into your own application. I have included the AM2315 sensor into my DHT11 network and it sends now outside data to the MQTT. Its ID is ESP8266-13972685.

The data coming from the AM2315 sensor are marked red in the screenshot while the data of another outside sensor ASH2200 are marked orange. The two sensors are outside but at different locations.

Screenshot_2016-04-06-16-14-55.png

The software am2315.lua and am2316_mqtt.lua is on Sourceforge and Github.

AM2315@NodeMCU

IOT Button (3rd)

I started the test after building this test environment:

IoT_NodeThree Energizer max AA cells power the IoT Node. Normally the IoT Node sleeps.

After pressing the reset button the IoT Node is connecting to the home network via Wifi, measured the battery voltage, and send a message to IFTTT.

There are two IFTTT receipts. One sends a Twitter direct message (to me) and the other makes an entry into a Google spreadsheet.  Follow the link to see decharging my power pack by this IoT button app.

IOT Button (3rd)

IoT Button

Amazon introduces its Dash Button to order much needed goods. But there are alternatives. Two of them are bt.tn and flic.

bt.tn and flic are just what the name suggests: connected push buttons that can trigger actions. Together with IFTTT they can trigger a growing number of services. Relating to the connectivity bt.tn and flic differ.

The bt.tn has built-in internet connectivity and needs no smartphones or apps to pair with. Flic uses a Bluetooth low energy connection to an Android or iOS smart phone and the flic app for network connection.

D1 mini button shieldThese offers are interesting to experiment with. But, we can build such an IoT Button by yourself and save a lot of money.

D1 mini combined with an 1-Button shield is one solution. You can buy both for $ 4.99 from Aliexpress.

Button Twitter

IFTTT offers channels for bt.tn and flic. IFTTT’s Maker Channel allows you to connect IFTTT to your personal projects like this IoT Button.

This time my IoT Button sends a Twitter Direct Message after pressing it. It’s a starting point to test the mechanism.

The configuration of IFTTT is well documented and should be no problem.

For a door contact application step-by-step instructions for IFTTT setup are in my book “IoT Node for les than 15 $”.

This time I work on reducing power consumption to get a battery-powered solution.

IoT Button

Measuring room conditions

thermo_hygrometerTo measure the room conditions we can use a traditional Thermo-Hygrometer as shown in the image.

If you want to see these conditions from any location around your home then you can use a cheap DHTxx shield connected to a D1 mini and dweet its data to dweet.io. Use freeboard.io to make these data visible at any location. The program sample dht_dweet.lua can be downloaded from Sourceforge.

You can use your smartphone or a tablet to visualize the room conditions of the observed room (https://freeboard.io/board/BQK578).

RoomConditions

Further information on NodeMCU and ESP8266 devices in “Building an IoT Node for less than 15 $” (http://amzn.com/3907857305; http://amzn.com/B018J1OVC4)

Measuring room conditions

Weather Data from OpenWeatherMap

To get local weather information you do not need an own weather station. There are a lot of web-based weather stations collecting weather data from local weather stations around the world. To get an overview look for Top 10 Weather APIs.

If you want to use their weather data you have to consider the limited ressources of the ESP8266/NodeMCU devices. It is not possible to operate payloads of a few Kilobytes . The TCP/IP stack has its limitations.

I tried Yahoo Weather and Weather Underground but their responses were to big in size. After looking around I found openweathermap.org which offers a lot of data but fitting with the ressources of  ESP8266.

If you want to use this information you have to register at openweathermap.org to get an API key. I will name it myAPPID here. A free account offers no more than 60 calls/min respectively no more than 50’000 calls/day. This is quite enough for a call every minute.

The following call will request the data for my location:

http://api.openweathermap.org/data/2.5/weather?q=Altendorf,CH&APPID=myAPPID.

The response looks like

{“coord”:{“lon”:8.83,”lat”:47.19},”weather”:[{“id”:804,”main”:”Clouds”,”description”:”overcast clouds”,”icon”:”04d”}],”base”:”cmc stations”,”main”:{“temp”:282.67,”pressure”:1029,”humidity”:81,”temp_min”:282.15,”temp_max”:283.15},”wind”:{“speed”:1.5,”deg”:140},”rain”:{“3h”:0.0175},”clouds”:{“all”:90},”dt”:1450273800,”sys”:{“type”:3,”id”:6007,”message”:0.004,”country”:”CH”,”sunrise”:1450249519,”sunset”:1450280128},”id”:2661776,”name”:”Altendorf”,”cod”:200}

The NodeMCU application has to call the server and has to evaluate the response sent from server back to the NodeMCU device. The NodeMCU (Lua) script getWeather.lua is saved at Sourceforge.

weather

After downloading the script getWeather.lua to the the NodeMCU device we will get weather data every minute.

Access data to the router and the API key myAPPID are saved in the file credentials.lua  called from init.lua to hide them.

 

Weather Data from OpenWeatherMap