RainBerry in Mag Pi Magazine Issue 79!!!

Today I received email about the MagPi Magazine Issue 79 and as always jumped on it. Hey, I noticed they have image of RainBerry for Raspberry Pi A+. They have two links in the magazine, one for Pinshape.com and one for commercial products. I initially only clicked the commercial link and thought authors missed this blog.


The Circuit Playground

This post is written by my 9 year old daughter.

The Ladyblog

This summer I went to a Bootcamp to learn about LEDs. So later that weekend, I made a tiny little program that measures the temperature inside the room that you are in.

What is Circuit Playground?

The Circuit Playground is a small board that has a lot of LEDs, buttons, and Sensors. The sensor that we used is temperature sensor in this demo. Circuit Playground is useful to help people practice programing. Once you get the hang of it, you can start doing wondrous things just with a little bit of programing in a Circuit Playground, and most importantly fun! The sensors in a Circuit Playground are:

  • Audio
  • Temprature
  • Light
  • X, Y ,Z Motion sensor

It also has an speaker, 10 LEDs and buttons.

A Simple Program

Now lets program the Circuit Board to measure the room temperature and check is it is to hot. If so, we will play an alarm that will tell you to get out of the room and all the  LEDs will flash rapidly.

#include <Adafruit_CircuitPlayground.h>

float tempF;

void setup() {
// put your setup code here, to run once:

void loop() {

// put your main code here, to run repeatedly:
tempF = CircuitPlayground.temperatureF();

Serial.print(” Tempture in the room degree is “);

if(tempF > 85)
Serial.println(“Room is Really Hot!!!!!!! Get out!!!!!!!!!”);
CircuitPlayground.setPixelColor(0,65, 244, 244 );
CircuitPlayground.setPixelColor(1, 244, 66, 161);
CircuitPlayground.setPixelColor(2, 65, 244, 244);
CircuitPlayground.setPixelColor(3, 244, 66, 161);
CircuitPlayground.setPixelColor(4, 65, 244, 244);

CircuitPlayground.setPixelColor(5,244, 66, 161);
CircuitPlayground.setPixelColor(6,65, 244, 244);
CircuitPlayground.setPixelColor(7,244, 66, 161 );
CircuitPlayground.setPixelColor(8,65, 244, 244);
CircuitPlayground.setPixelColor(9,244, 66, 161);

CircuitPlayground.playTone(500, 100);
CircuitPlayground.setPixelColor(0, 0, 0, 0);
CircuitPlayground.setPixelColor(1, 0, 0, 0);
CircuitPlayground.setPixelColor(2, 0, 0, 0);
CircuitPlayground.setPixelColor(3, 0, 0, 0);
CircuitPlayground.setPixelColor(4, 0, 0, 0);

CircuitPlayground.setPixelColor(5, 0, 0, 0);
CircuitPlayground.setPixelColor(6, 0, 0, 0);
CircuitPlayground.setPixelColor(7, 0, 0, 0);
CircuitPlayground.setPixelColor(8, 0, 0, 0);
CircuitPlayground.setPixelColor(9, 0, 0, 0);

Serial.println(“Enjoy the room”);


Lets try to understand what I wrote in this code. First we Read the temperature in degree F. Next we check if the temperature is greater than 75 degree F, then we tell it to turn on all the LEDs and start honking noise. We turn off LED after 1 second. This repeats until temperature reduces or battery dies.

Let me tell you how to decide the RGB value to get the color(s). All you need to do is go to google and search RGB color picker. Screen Shot 2018-08-19 at 3.33.08 PM.png

3D Printing a Case

Did you know I have a 3D printer? To keep the Circuit safe and to make the finished product, I 3D printed a case that is also made by Adafruit. We attached a small battery and stuck it with tape on the back.



We bought the M3 screws from Home Depot. To show a demo of how it works, I will keep my finger on the Temperature sensor.


Overall, I thought it was a great and clean way to learn programing as well as making something useful. You could make several things with Circuit Playground. For example, you could make a device that can alarm when Sun comes up in the morning or blink lights when you ride a bike.

So what would you like to make?

Raspberry Pi Camera: Face Recognition and Email Alert

Though Open CV installation is highly time consuming process on a Raspberry Pi A+, it has multiple uses when it comes to image recognition. Framework created by Tony in his face recognition treasure box project is modified here for a camera which sends messages whenever it finds someone is in the backyard.

How it works?

Camera records images constantly and then passes it to the Open CV for face recognition. Once it recognizes a face in the image, it sends alert to the email address with the image in the attachment. You can modify this code further to include any other object recognition such as cat etc.


You can download the code which uses OpenCV 2.4.9 from here. Before you use it, you need to generate a password for the app from Gmail.

Gmail provides the following guidelines to generate the app password for emailing directly from Raspberry Pi. Use “other” option to generate the password for the app to login to Gmail and send an email.

Delicious Liquid Nitrogen Science

Today I planned to visit the newly opened “The Village Workshop” in Northville, MI for 3D printing some parts. It is really awesome facility to have in the neighborhood for every maker.

While waiting for 3D printing assistance at the entrance, I bumped into a demonstration by Willie from Kold Ice Cream. Both me and my daughter were stunned to see fumes of liquid nitrogen on the table.


Willie was dropping liquid nitrogen on the hands, serving snacks dipped in it which was more fun to see exhaling cold fumes. He offered us a neat explanation behind cold nitrogen boiling at room temperature with boiling point of -196 deg C and turning into vapors. Though it is dangerous to leave your fingers for longer period in the liquid nitrogen, Willie seems fine dropping liquid nitrogen on hands and his shirt.

He showed me and my daughter some cool stuff, like starting fire and then extinguishing with nitrogen fumes and liquid. Too much liquid nitrogen around the flame stops it due to lack of oxygen nearby.

Most important part for my daughter was the liquid nitrogen ice cream preparation. It turned out that it was best ice-cream she ever tasted.


Delicious science study was really cool for all the kids visiting the workshop today. I hope it attracts them to creative developments in STEM field.

Calculation of Heat Pumped by Peltier

Peltier units are simply heat pumping devices and have really low COP compared to conventional vapor compression cycle based units. To estimate, how much amount of heat is pumped, I did a simple experiment. I bought a simple Peltier unit from Adafruit and glued it to a heat sink with thermal tape.

I put the heat sink in the measured amount of water (160 gm) and recorded temperature with TMP 35 sensor. Initial temperature of water was 31 deg C and final temperature after 300 seconds was 44 deg C.

Resistance of the Peltier was around 3.1 ohm from the current (2.6 A) and voltage (9.6 V) measurement.

  1. Amount of total energy energy dissipated (Qd) in water is 8706 J from m*Cp*(Tf-Ti)
  2. Energy supplied (E) over the 300 seconds was found to be 7488 J from V*I*t
  3. Heat generated to resistance (Qr) is small 21.9 J from I^2*R loss.
  4. Amount of heat removed from cold side = Qd – Qe – Qr = 1197 J or about 4 W
  5. This comes to COP = 4 W/(2.6 A*9.6 V) = 0.16

This calculation is rough estimate of the COP as thermocouple was +/- 2 deg C accuracy. Also this test does not indicate the performance of peltier in other operating conditions. It was done just to know how good is the peltier performance.

Peltier Cooling and Heating with Arduino

Cooling with Peltier

I used a Peltier fan heat sink unit sold by Adafruit for this work. Small plate connected to this Peltier unit cools to a really low temperature of -7 deg C almost instantly due to its small size. I used Arduino UNO with N-channel MOSFET to control the Peltier unit. Program and Arduino circuit used came from this work on garagelab.com.


Peltier with fan heat sink unit

Heating and Cooling a Peltier

I was working with a friend to explore option of simultaneous heating and cooling for neonatal care in India (http://www.palav.org/). I could not find easily an option for simultaneous heating and cooling with Peltier. There are many posts for cooling control. Several people mentioned using H bridge for reversing currents on Arduino forums. Still it was difficult to find which one will work with Peltier unit that I have. This is just an attempt to know that it is possible to use H bridge for this purposes. It gives precise control over temperature required with both heating and cooling. Ultimately I found it is possible but costly option for amount of heating and cooling required.

For simultaneous heating and cooling H-bridge is needed. I used Pololu simple high power motor controller for this work and used sample program from Pololu with Arduino. Software serial library is also needed with this, which is available on Arduino website. Change input to setMotorSpeed from -3200 to 3200 to control the cooling and heating respectively. This works great for the Peltier fan heat sink unit.

Connecting Pololu is easy with image from the H-bridge user guide.

Connect Arduino digital pin 4 to Simple Motor Controller RX and Arduino GND to Simple Motor Controller GND.

#define rxPin 3  // pin 3 connects to smcSerial TX  
#define txPin 4  // pin 4 connects to smcSerial RX
SoftwareSerial smcSerial = SoftwareSerial(rxPin, txPin);
// required to allow motors to move
// must be called when controller restarts and after any error
void exitSafeStart()
// speed should be a number from -3200 to 3200
void setMotorSpeed(int speed)
  if (speed < 0)   
smcSerial.write(0x86);  // motor reverse command     
speed = -speed;  // make speed positive   
smcSerial.write(0x85);  // motor forward command   
smcSerial.write(speed & 0x1F);   
smcSerial.write(speed >> 5);
void setup()
  // initialize software serial object with baud rate of 19.2 kbps
 // the Simple Motor Controller must be running for at least 1 ms
 // before we try to send serial data, so we delay here for 5 ms
 // if the Simple Motor Controller has automatic baud detection
 // enabled, we first need to send it the byte 0xAA (170 in decimal)
 // so that it can learn the baud rate

 smcSerial.write(0xAA);  // send baud-indicator byte
 // next we need to send the Exit Safe Start command, which
 // clears the safe-start violation and lets the motor run
 exitSafeStart();  // clear the safe-start violation and let the motor run
void loop()
 setMotorSpeed(-2800);  // full-speed forward
 // setMotorSpeed(3200);  // full-speed reverse 
 // delay(1000);