rpiarduinomusings

Raspberry Pi, Arduino, Sensors and the data they produce

A Shift in Tools – The 8266 and the Arduino IDE

Well winter came around, and time in the workshop got shortened, so I got back to the electronics and computers in the nice warm house.  I was still struggling with both range and setup of the NRF24L01+ with the Arduino.  It just seemed too complex and getting the sensor power down to a usable level required dropping components.

I was looking around the web for ideas, and I got distracted by a little OLed / 8266 Weather device.  Well, it was available on Amazon Prime and I was stuck on the problem at hand, so I placed my order, and two days later this device showed up at my door.   Note: I am not an agent for Amazon, I just think this is a great little project!

https://www.amazon.com/ESP8266-Starter-OLED-display-Arduino/dp/B01KE7BA3O/ref=sr_1_1?ie=UTF8&qid=1486953226&sr=8-1&keywords=squix

When you purchase this unit, the developer / blogger gives you a great tutorial PDF link that you can download and build from.  He has a great blog site too, so give it a read:

https://blog.squix.org

Now, because of the tutorial, I was able to get this item up and running in just a short time, and it opened my eyes to a new device, while delivering a good product!  IN fact, I immediately went back to Amazon, and ordered a couple more of the NodeMCU / 8266 prototyping boards.  Then I dove off the deep end with out my floaties!

You know how Google, Bing or Duck Duck go searching happens, and then you surface a few hours later?  That happened.

What I found was a huge eco-structure around this 8266 chip.  There were two directions that this led me, and that cost several more hours.  Maybe this post will help you if you get started down this same path.

Direction One is what I went with due to the Squix path, which goes the route of modifying the Arduino IDE which I think you are probably familiar with if you are reading this blog and following any of the experiments I have previously presented.

In short you add libraries into the IDE that allows reprogramming of the NodeMCU.

WARNING: I DO NOT YET KNOW HOW TO RETURN THE CHIP TO IT”S ORIGINAL PROGRAMMING – So I will take no responsibility if you follow this path and re-program with the Arduino IDE and any code presented here.

Direction Two:

This is the original effort and most of the NodeMCU chips come pre-programmed with this code/environment. It is called NodeMCU/Lua.  Lua is a programming language that you can do further searches to get more details on. While I like this environment, I think I have not dug into it far enough to get a real feel for this approach.

That explanation completed, I learned the IDE modification while making my little weather station.  In the same tutorial, it was mentioned that to go beyond the simple receipt of weather info from use of the wunderground API, you would need an external sensor.  Well, I did have a couple extra NodeMCU’s to play with so off I went.  The really cool thing here was that there was code ready built if you chose to take this challenge.  And it was easy, since in the prior posts we experimented with PIR sensors and DHT-11 temp/humidity sensors, I had the needed parts already.  Not to mention the 500 or so jumper wires in my parts bin.

Then build again was quite simple, and I quickly had the nodeMCU programmed.  Now the operation strayed a bit, and I needed to set up an account on Thingspeak.  Thingspeak is an on-line cloud service that offers a free section, and some analytic tools that are pretty cool. It has ties to MATLAB, so they definitely want you to grow your data and find you way onto a paying service, it all depends on volume.  I went ahead and signed up, so I could “see” the data coming out of my little oLed.  You set an API key here, and put that in your programming code so your little device can transmit it out to the cloud, then the weather display can go get that same data and bring it back down.

 

THis was great, I was able to build both parts of this, get an oLed displaying the weather, and the authors code displayed my local sensors temp/humidity from two place in my house, how cool is that, right?

Okay, so in all of this writing, I forgot something. Some. Thing. BIG.

Why did this little device grab my attention in the first place:  It has wifi on board, similar to the nrf24L01+.  But this was so much easier! Why you ask, because of this little snnipet of code:

#include <ESP8266WiFi.h>
#include TheDudeParams.h // Change this file params
//INIT
const char* ssid = MY_SSID;
const char* password = MY_PWD;
const char* host = MY_HOST;
const char* hostIP = MY_HOSTIP;
String url = /getIP.php?psswd=;
WiFiServer server(80);

So why does this excite me so?  Simple:  You can use your existing wifi to send the data across, and that really plays into my GRAND DESIGN of having everything  I want on my sensor network.  Woot!

But then I crashed again.  I really did not want to have to depend on a cloud service to send my data to, and if I got as many sensors as I dream  up built, I might have to pay for the service, and that was not what I wanted. I also considered what if the cloud server was off-line, or worse, went away completely?

Now I had to go and learn more,  if these devices could send data across my wifi,  there must be ways to work with that data separately from the cloud (note: I still have a few devices sending to the cloud.)

Well, back to the internet, back to searching and searching and searching.  IN my next post I’ll get into the tools and techniques  I found, and what I did with that info.  Stay tuned for more.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: