Raspberry Pi, Arduino, Sensors and the data they produce

Category Archives: Getting Started

Playing with a NodeMCU /8266 Debugging

Playing with a NodeMCU /8266 Debugging

For a deeper dive into the tools, I wanted to play with the NodeMCU /LUA environment (3) , while debugging a NodeMCU that I could not seem to get to take the arduino 8266 code.

The Arduino programming of 8266 was an extension of something I already was familiar with, but this one chip would not take a program through that method.
 I decided to look into the native code that comes from the factor, which is Based on NodeMCU.  I searched and found a tool called ESPlorer, but it was made in Russia.   At first I was a bit apprehensive, but then I found I could get the source code, meaning I could look at the code, and then setup from that which made me happy.
With this tool and a bit of learning from a couple of my favorite sites(1, 4), I was able to launch and run the code, and to get a response from the “wayward” chip.
I found a init.lua file that after inserting my SSD and passphrase, I was able to get it uploaded and executed:
tmr.alarm(1, 1000, 1, function()
    if wifi.sta.getip() == nil then
        print(“IP unavaiable, Waiting…”)
        print(“ESP8266 mode is: ” .. wifi.getmode())
        print(“The module MAC address is: ” .. wifi.ap.getmac())
        print(“Config done, IP is “..wifi.sta.getip())
Next I got a small webserver code to run:
    conn:send(“<h1> ESP8266<BR>Server is working!</h1>”)
ESPlorer interface as I execute the two code snippets::
Inline image 1
Web Page output:
Inline image 2
I hope to update this NodeMCU so that I can program it just as I did the earlier units, but this was a fun learning experience!
The ESPlorer user interface (in java)
Inline image 3
(1) http://randomnerdtutorials.com/esp8266-web-server/
(2) https://esp8266.ru/esplorer/
(3) https://nodemcu.readthedocs.io/en/master/en/flash/
(4) https://benlo.com/esp8266/esp8266QuickStart.html

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!


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:


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
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.



Basic Configuration for Raspberry Pi


This post presents the steps for a base configuration of a Raspberry Pi. The model used is the newer Raspberry Pi 3, Model B.

The steps that follow pick up after Raspbian (Jessie) has been installed and functioning. There will be little in the way of discussion, letting the instructions for each step act as the documentation.
Read more of this post

Pi, Cameras, Security, and NAS

We have been busy with many projects in our group, but have not posted or documented much.  This blog entry will attempt to be a recap of the e-mail discussions and the final setups we chose, your mileage may vary!

We have taken several approaches to utilization of cameras within our environment.


The first approach used was one from Claude Pageau who documented his environment so well that it is simple to say – “just do it” based on his GitHub.com readme!  See the references page for the link.

Read more of this post

Sensor Network –First Deployment

Well, you have to start somewhere, so while this code is neither clean nor fully functional, it does demonstrate the functionality of the effort underway. This code reflect two sensors basically streaming their name and current info, and the receiver RPi scrolling the received info across the screen.

Also my first attempt at putting code in the blog, so we’ll see how it works.

The next code iterations will remove all the screen displays and move to writing a file with the sensor node name and accompanying data from the sensors to a comma deliminated file (.csv).

Arduino based sensors transmitting to the Raspberry Pi via NRF24L01+

This post shows two code blocks, one for any Arduino sensor node and the second is the RPi receiving code.
The Arduino Sensor Node Transmitter -Send-Recieve

#include #include #include // ce,csn pins RF24 radio(9, 10); void setup(void) { while (!Serial); Serial.begin(9600); radio.begin(); radio.setPALevel(RF24_PA_MAX); radio.setChannel(0x76); radio.openWritingPipe(0xF0F0F0F0E1LL); const uint64_t pipe = 0xE8E8F0F0E1LL; radio.openReadingPipe(1, pipe); radio.enableDynamicPayloads(); radio.powerUp(); } void loop(void) { radio.startListening(); Serial.println(“Starting Loop. Radio on.”); char receivedMessage[32] = {0}; if (radio.available()) { radio.read(receivedMessage, sizeof(receivedMessage)); Serial.println(receivedMessage); Serial.println(“Turning off the Radio.”); radio.stopListening(); String stringMessage(receivedMessage); if (stringMessage == “GETSTRING”) { Serial.println(“Looks like they want a string!”); const char text[] = “Hello World!” ; radio.write(text, sizeof(text)); Serial.println(“We sent our message.”); } } delay(1000); }

Raspberry Pi Gateway -Send-Recieve

import RPi.GPIO as GPIO from lib_nrf24 import NRF24 import time import spidev GPIO.setmode(GPIO.BCM) pipes = [[0xE8, 0xE8, 0xF0, 0xF0, 0xE1], [0xF0, 0xF0, 0xF0, 0xF0, 0xE1]] radio = NRF24(GPIO, spidev.SpiDev()) radio.begin(0,17) radio.setPayloadSize(32) radio.setChannel(0x76) radio.setDataRate(NRF24.BR_1MBPS) radio.setPALevel(NRF24.PA_MIN) radio.setAutoAck(True) radio.enableDynamicPayloads() radio.enableAckPayload() radio.openWritingPipe(pipes[0]) radio.openReadingPipe(1, pipes[1]) radio.printDetails() #radio.startListening() message = list(“GETSTRING”) while len(message) 2: print (“Timed out.”) break receivedMessage = [] radio.read(receivedMessage, radio.getDynamicPayloadSize()) print(“Received: {}”.format(receivedMessage)) print(“Translating our received Message into unicode characters…”) string = “” for n in receivedMessage: if (n >= 32 and n <=126): string += chr(n) print(“Our received message decodes to: {}”.format(string)) radio.stopListening() time.sleep(1)

Hello world!

We are group of guys playing with automation, instrumentation, and data from our homes.  Here we will attempt to document and share our efforts to work with this technology.  You can expect to see various notes are we learn the environments of Arduino and Raspberry Pi, and attempt to fuse sensors, and the data they produce.