Tag Archives: IoT

Temperature Controlled Stair lights With Raspberry Pi

Ever wished to know the temperature on your way to breakfast after waking up in the morning? Now you can find it out in a fascinating way as Lorraine Underwood at The MagPi magazine designed a temperature controlled colorful stair lights system with raspberry pi. In this tutorial, we’re going to discuss that project.

Temperature Controlled Stair Lights
Temperature Controlled Stair Lights

Required Parts

  • Strip of 50 neopixels
  • A 5V power source for the lights
  • 2 x terminal blocks
  • 2 x male to female jumper cables
  • A raspberry pi zero with SD card with Raspian installed
  • Power supply for the Pi zero (temporary)


Make sure that the raspberry pi power supply gives exactly 5 volts and is capable of outputting 2.5A current.

Make The Circuit

At first, examine your LED strip and find out which pin is what. Connect two wires to GND, one wire to Din, and one wire to +5V pin. Now, connect the 5V pin to the “+” terminal of the female jack and GND pin to the “-” terminal. Tighten the screws of the terminal block to ensure that the wires are connected properly.

Connect the Din and GND pin of the LEDstrip to the GPIO 18 and GND of the Raspberry Pi respectively, using the male-to-female jumper wires. Please note that Broadcom numbering (BCM) is used in this tutorial, not the physical numbering. It will look like below after making the connections:

Connecting Wires To The LED Strip
Connecting Wires To The LED Strip

Set Up The Weather API

You need to set up a weather API in order to get the outside temperature in your area. In this tutorial, forecast.io is used as they allow you to make 1000 queries per day free of cost. Go to forecast.io and select Developer option. Then, click sign up to create a developer account and provide your email address. A secret key will be sent to that address. Store it securely as you’ll need in the next step.

Prepare The Raspberry Pi

At first, you need to install the Adafruit NeoPixel library rpi_ws281x. Go here and follow the instructions to install the required files on your raspberry pi. Once installed, navigate to the examples folder, run any script you wish, and check if the LED strip is functioning properly.

Now, save the below script as stair_lights.py in the Raspberry Pi:

from urllib.request import urlopen
import json
import time
from neopixel import *

apikey="get_your_own_key" # get a key from https://developer.forecast.io/register
# Latitude & longitude - current values are Lancaster University

LED_COUNT = 50 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 5 # DMA channel to use for generating signal (try 5)
LED_BRIGHTNESS = 8 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)

def color(strip, color, start, end): 
 for i in range(start, end+1):
 strip.setPixelColor(i, color)

count = 0
 while True: 
 #get the data from the api website
 meteo = meteo.decode('utf-8')
 weather = json.loads(meteo)

currentTemp = weather['currently']['temperature']

#negative number will always be on 
 color(strip, Color(0, 0, 255), 0,7) # Blue
 #what's the temp?
 if currentTemp > 0:
 color(strip, Color(75, 75, 255), 8, 15) # light Blue
 if currentTemp > 5:
 color(strip, Color(0, 255, 0), 16, 23) # dark Green
 if currentTemp > 10:
 color(strip, Color(75, 255, 75), 24, 31) # light Green
 if currentTemp > 15:
 color(strip, Color(255, 100, 0), 32, 39) # yellow 
 elif currentTemp > 20:
 color(strip, Color(255, 50, 0), 40, 47) #orange 
 elif currentTemp > 25:
 color(strip, Color(255, 0, 0), 48, 50) # Red 
 #check every 5 minutes (change to crontab)
except KeyboardInterrupt:
 color(strip, Color(0,0,0), 0, 49)

Enter your own secret key in the apikey field on the 7th line. Also, replace the longitude and latitude values on line 9 and 10 with the coordinates of your area. Now save the file and you are almost done.

To start the script automatically after each reboot and check the outside temperature every five minutes, set up a cron task by entering the following command:

sudoE crontab -e

A file will be opened and add the following lines at the end of the file:

*/5 * * * * /usr/bin/python3 /home/pi/stair_lights.py
@reboot /usr/bin/python3 /home/pi/stair_lights.py

Save the file and exit.

The Color Scheme

The following table shows which color represents which temperature range. You can modify the script to change the current color scheme.

Temperature (°C) Lights (Nos) Color
 0 – 4  9 – 16 Light Blue
 5 – 9 17 – 24 Dark Green
 10 – 14 25 – 32 Light Green
 15 – 19 33 – 40 Yellow
 19 – 24  41 – 48 Orange
 25+  48 – 50 Red


Open IoT Certification Mark – A New Certification For IoT Products

So it’s the time to witness the birth of a new certification for IoT industry. As security and data privacy in IoT platforms and products are two of the main concerns for developers and end-users, the new certificate discuss these concerns and even more. IoT is yet to have such certificate, as best of my knowledge, to pave the road to standardize the rules of openness and privacy in IoT. Although the term of IoT certification is already there, and some companies can do security test for your IoT products and certificate it, but nothing seems to analogy to certificate like open source hardware certificate, where anyone meets the principals, can use the OSH mark on his product.

Image courtesy of IoT.do

The new certification IoTMark was the output of a meetup hosted on June 16th 2017 in UK. This meetup gathered over 60 participants from UK and Europe. Specifically, a 22-page-long document was the output from this meetup. This document contains the principles of the certificate:

  • Privacy
  • Interoperability
  • Ownership, Permissions, Entitlement
  • Cost/biz models/pricing transparency
  • Security
  • Lifecycle, provenance, sustainability & future-proofing

To mention a few of these principles:


The supplier of this product or service MUST be General Data Protection Regulation (GDPR) compliant.

This product SHALL NOT disclose data to third parties without my knowledge.

I SHOULD get full access to all the data collected about me.



  1. Have an open platform API [MUST]
  2. Provide comprehensive platform API documentation [MUST]

The preparation for the certificate didn’t finish yet, where The folks behind this certification will finalize it and register the mark by December 2017.

Don’t forget to have a look at the full document here. Who knows; You could use it in your next product. It’s really worth to give it a bid!

Source: Adafruit Blog

LoRaCatKitty: Build IoT Applications with LoRa in 3 steps!

Based on the ESP8266 module, “Andres Sabas” unite the best of WiFi and LoRa, Facilitating the development of IoT solutions.

LoRaCatKitty is designed to simplify the development of Internet of Things (IoT) applications using the fabulous (but still underutilized) LoRa Technology. We have based our development on the ESP8266 WiFi module and the LoRa RN2903 or RN2483 microchip module, and we have designed it to allow you can create IoT applications without deep knowledge of technology.

Renesas Electronics Achieves Lowest Embedded SRAM Power of 13.7 nW/Mbit

Renesas Electronics Corporation announced the successful development of a new low-power SRAM circuit technology that achieves a record ultra-low power consumption of 13.7 nW/Mbit in standby mode. The prototype SRAM also achieves a high-speed readout time of 1.8 ns during active operation. Renesas Electronics applied its 65nm node silicon on thin buried oxide (SOTB) process to develop this record-creating SRAM prototype.

Renesas Embedded SRAM prototype with SOTB Structure
Renesas Embedded SRAM prototype with SOTB Structure

This new low-power SRAM circuit technology can be embedded in application specific standard products (ASSPs) for Internet of Things (IoT), home electronics, and healthcare applications. The fast growth of IoT is requiring all the devices be connected to a wireless network all the time. Hence, products must consume less power to prolong battery life. With this new technology applied, much longer battery life can be achieved enabling maintenance-free applications.

One essential part of the development of IoT applications is the miniaturization of end products. This can be achieved by lowering battery capacity requirement of ASSPs. As an effort to reduce the power consumption in ASSPs for the IoT, there is a technique in which the application is operated in the standby mode and only goes to the active mode when data processing is required.

Now, the conventional way of saving power is to store all important data to an internal/external non-volatile memory and cut off the power supply to the circuit. If the wait time is long enough, this method is effective. But in most of the cases, the device has to switch between standby mode and active mode very quickly causing data-saving and restarting process extremely inefficient. There are even cases where, inversely, this increases power consumption.

In contrary to above, the new technology by Renesas Electronics uses a method where power consumption in standby mode is reduced a lot enabling switching operation to be performed frequently without leading to increased power consumption. Hence, it’s no more required to save data to non-volatile memory. This improves the efficiency further.

The low-power embedded SRAM which is fabricated using the 65 nm SOTB process, achieves both the low standby mode power consumption and increased operating speed.  Such features were difficult to achieve with the continuing progress of the semiconductor process miniaturization.  Renesas plans to support both energy harvesting operation and development of maintenance free IoT applications that do not require battery replacement by enabling ASSPs that adopt the embedded SRAM with SOTB structure.

To learn about all the complex technical information which is not covered in the scope of this article, visit the press release page of Renesas Electronics.

Bluey, BLE Development Board Supports NFC

Development boards are assistant tools that help engineers and enthusiasts to become familiarized with hardware development. They simplify the process of controlling and programming hardware, such as microcontrollers and microprocessors.

Electronut Labs, an embedded systems consulting company, had produced its new BLE development board “Bluey” with a set of useful sensors and NFC support.

Bluey is an open source board that features the Nordic nRF52832 SoC which supports BLE and other proprietary wireless protocols. Bluey has built-in sensors that include temperature, humidity, ambient light and accelerometer sensors. Also, it supports NFC and comes with a built-in NFC PCB antenna.

The nRF52832 SoC is a powerful, ultra-low power multiprotocol SoC suited for Bluetooth Low Energy, ANT and 2.4GHz ultra low-power wireless applications. It is built around a 32-bit ARM Cortex™-M4F CPU with 512kB + 64kB RAM.

Bluey Specifications:

  • Nordic nRF52832 QFAA BLE SoC (512k Flash / 64k RAM)
  • TI HDC1010 Temperature/Humidity sensor
  • APDS-9300-020 ambient light sensor
  • ST Micro LSM6DS3 accelerometer
  • CP2104 USB interface
  • 2 push buttons
  • Coin cell holder
  • Micro SD slot
  • 2.4 GHz PCB antenna
  • NFC PCB antenna

Bluey can be programmed using the Nordic nRF5 SDK. You can upload the code with an external programmer such as the Nordic nRF52-DK, or the Black Magic Probe firmware on STM32F103 breakout. But, within the built-in OTA (over the air) bootloader, you can upload the code directly using a PC or a phone.

The sensors on the board require a minimum of 2.7 volts to function properly, and the maximum power is 6 volts. Bluey’s design offers three different ways to power it, all of them have a polarity protection:

  1. Using the 5V micro USB connector (which also gives you the option to print debug messages via UART).
  2. The + / – power supply pins which can take regular 2.54 mm header pins, a JST connector for a 3.7 V LiPo battery, or a 3.5 mm terminal block.
  3. A CR2032 coin cell for low power applications.

You can use Bluey for a wide range of projects. The BLE part is ideal for IoT projects, or if you want to control something with your phone. The nRF52832 SoC has a powerful ARM Cortex-M4F CPU, so you can use this board for general purpose microcontroller projects as well.

Bluey is available for $29 for international customers from Tindie store. Indian customers can purchase it from Instamojo store. There are also discounts for bulk purchases. For more information about the board visit its github repository, where you will find a full guide to start and a bunch of demo projects.

YouTube channel IoT view counter

Kenneth Finnegan built this YouTube channel IoT view counter. He writes:

I’ve wanted an Internet connected read-out for some time now, inspired by the awesome shadow box IoT projects Becky Stern has been doing (weather, YouTube subscribers). I’m certainly not to the same level of packaging as her yet, but I’ve got a functional display working with a Hazzah and an eBay seven segment display module.

YouTube channel IoT view counter – [Link]

Mongoose OS Operating System for Connected Devices

Another OS for IoT applications called Mongoose OS. Like the other OS’s for IoT, Mongoose OS has some security features like:

  • Microchip ECC508A crypto chip support.
  • Supporting mbedTLS library from ARM.
  • Implementation of file system encryption and full SPI-flash encryption on ESP32.

Mongoose implements the API for: HTTP, WebSocket, MQTT and CoAP; for both client and server and with a rich API and a tiny footprint. Moreover, it integrates with Amazon AWS IoT service, Google IoT Core and Adafruit IO online service.

Talking about the SDK; Mongoose prefers to use native SDKs instead of building them from scratch by extending the original ones. The current supported microcontrollers are ESP32, ESP8266, STM32, TI CC3200. You can develop your code in C or JavaScript using mJS engine (part of Mongoose OS).

For device management and firmware building Mongoose uses a tool called mos. This tool works in Windows and Linux as a command line interface or a web UI.

In the video below there is an example of running a built-in web server using ESP WiFi module.


Last but not least, Mongoose supports the following hardware interfaces: Bitbang, GPIO, I2C, NeoPixel, SPI and UART. It can also performs remote management for the device such as: file system (list, get, put and remove), configuration, I2C, GPIO and OTA

An example of upgrading the firmware over the air (OTA) is explained in the video below :


SYNTHETIC SENSORS, All-In-One Smart Home Sensor

In the era of Internet of Things, we wanted most of our home appliances to become smart. But currently, smart devices may cost much more than their offline counterparts and they often do not communicate with each other. Trying to overcome these limitations, A Ph.D student invented a way to turn entire rooms into smart with a single low-cost device called “Synthetic Sensors“.

Gierad Laput, is a Ph.D. student of computer-human interaction at Carnegie Mellon University. His research program explores novel sensing technologies for mobile and wearable computing, smart environments, and the Internet of Things.

Synthetic Sensor is a general purpose sensor that is powered directly from a wall socket and tracks ambient environmental data to monitor an entire room. It removes the need to attach additional hardware to each of home appliances.

We explore the notion of general-purpose sensing, wherein a single, highly capable sensor can indirectly monitor a large context, without direct instrumentation of objects. Further, through what we call Synthetic Sensors, we can virtualize raw sensor data into actionable feeds, whilst simultaneously mitigating immediate privacy issues. We use a series of structured, formative studies to inform the development of new sensor hardware and accompanying information architecture. We deployed our system across many months and environments, the results of which show the versatility, accuracy and potential of this approach.

The device uses machine learning to recognize the events that happen in the room, like recognizing a particular sound pattern as taking a paper towel, but it cannot monitor when the roll may need to be changed. However, by using a “second order” sensors, the devices can capture counts and send notifications of the need to replenish. This capability can be scaled to an unlimited degree giving consumers highly specific and applicable feedback.

Developers can use the recognized events as triggers for other IoT applications. For example, one could use “left faucet on” to activate a room’s left paper towel dispenser and automatically schedule a restock when its supply runs low.

The Synthetic Sensor is still in prototyping phase, you can learn more about it by visiting its website and read the research paper. Watch this video to see Synthetic Sensors in action:

Post Tweets With Your Raspberry Pi

Raspberry Pi is famous for its great computing strength and ability to run the Linux operating system. In today’s tutorial, you’ll learn how to make your Raspberry Pi tweet. You can add extra features to this project to post tweets autonomously if any specific event occurs. Let’s get started.

Required Parts

You’ll need following parts to make this project.

  • Raspberry Pi running Raspbian OS (Any model)
  • USB Mouse
  • USB Keyboard
  • HDMI Compatible Monitor
  • HDMI Cable
  • USB power supply for Raspberry (5V 2A)
  • Working Internet Connection

Create App In Twitter

You need to create an app in Twitter so that Raspberry Pi can use to make tweets on your behalf. Go here to make a twitter app. The Raspberry Pi will require following parameters to make tweets:

  • Consumer Key (API Key)
  • Consumer Secret (API Secret)
  • Access Token
  • Access Token Secret

You can find all these details from your app.

Creating An App In Twitter
Creating An App In Twitter

Store Keys In Raspberry Pi

In this step, you need to create a python file in your Raspberry Pi and store all the Keys and Tokens there. Create a file named keys.py in your working folder with all information in it.

consumer_key = "Place your consumer key here"
consumer_secret = "Place your consumer secret key here"
access_token = "Place the access token here"
access_token_secret = "place the access token secret here"
Get Access Keys And Access Tokens From App
Get Access Keys And Access Tokens From App

Now, save the file and go the nex step of this tutorial.

Install Twython

Well, what is Twython actually? Twython is the premier Python library providing an easy way to access the Twitter data. It’s been tested by companies, educational institutions and individuals alike. This amazing library will make our job a lot easier and the code much shorter. To install the Twython library, follow the given steps:

 sudo apt-get update sudo apt-get upgrade
 sudo apt-get install python-setuptools
 sudo easy_install pip
 sudo pip install twython
 sudo pip install requests
 sudo pip install requests-oauthlib

pip is required to install Twython, so it’s installed in 3rd step. But if you already have pip installed, just ignore that step.

Write The Python Script & Run It

Open a file in your working directory in your Raspberry Pi and rename it to twitter.py. Make sure that it is in the same directory wit previously created keys.py file. Now, copy-paste the following code using any editor or IDE:

import sys

from twython import Twython
from keys import (
twitter = Twython(
message = "My first tweet using Rapberry Pi! Yeh!"
print("Raspberry Pi successfully tweeted: %s " % message)

Pretty simple, isn’t it? Actually, the Twython library performs lots of tasks behind the screen keeping the code surprisingly small.

Now, save the file and open terminal in your raspberry pi. Write the following command and hit the Enter key to run this Python script:

python twitter.py

That’s all. Now you can see that is your Raspberry Pi is tweeting successfully.

Getting started with Python and Arduino MKR1000 for secure IoT projects

A getting start guide to program Arduino MKR1000 in Python:

The MKR1000 is described as a powerful board that combines the functionality of an Arduino Zero (already supported by Zerynth) and the connectivity of a Wi-Fi Shield, with a Cryptochip for secure communication. The design also includes a Li-Po charging circuit that allows the Arduino MKR1000 to run on battery power or external 5V, charging the Li-Po battery while running on external power.

Getting started with Python and Arduino MKR1000 for secure IoT projects – [Link]