Timelapse with Raspberry Pi and RainBerry

Raspberry Pi is quite useful in recording timelapse videos. Personally I liked Raspberry Pi A+ version due to small form factor and low power consumption. With advent of RainBerry case it is easy to mount the Pi camera outdoor and record the time lapse video.

With just one raspivid command you can start recording the images at a set period and then stitch images to a desired video format with mencoder.

I mounted RainBerry in my backyard and recorded timelapse of 24 hrs period. Recording images at 1 minute time interval created this video. When recording video over such a long period best way is to login to Pi over vnc, start a screen session, start time lapse and detach screen. To stop login to pi, restore screen and stop timelapse.

Get your RainBerry case from Pinshape to create timelapse for either 3D print, city traffic, garden, sky or nature.


Video below is over a shorter period of 1hr approximately focusing on the sky with 1 minute image recording.


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.

Dollhouse Fan – 3D Print

My daughter asked me several times to create a dollhouse fan. In the past, I did use CAD software, but mainly for simulation and never created any complete product up to manufacturing. So this was a daunting task to create a small dollhouse fan right from scratch in CAD software.

CAD model of the assembled fan looked nice.


I printed the CAD model on Shapeways in flexible plastic (Nylon) dyed in Pink. For my daughter, Shalvi, everything has to be Pink. It was quite cheap, costing shipping more than 3D print.


When 3D print arrived, it looked really cool except the lots of powder left in the motor holder shaft. Obviously, I missed providing more than one escape hole for blowing the nylon powder. I cleaned up the remaining powder manually.

For motor, I used a nice and cheap helicopter rotor motor from dx.com. It fitted perfectly to the designed motor holder. Motor wires were passed through the motor holder hollow pipe for connecting to a small battery cell. Hole in fan was smaller than designed in CAD, which came as a surprise. I tried drilling, but material was too tough for that. After repeated attempts, I was able to increase fan hole slightly and finally used gorilla glue to hold the shaft in place.

Here are some of the pictures after it arrived and assembled.

image (4) image (5)

image (3)

image (2)

Even with small battery cell, fan runs really fast. Next iteration will be to include even smaller battery and completely enclose the motor inside the motor holder. It was nice project for me to design for 3D print and assemble the fan.

If you like this work, please cast your vote for this fan for 3D printing competition on Instructables.

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);

Gauges for Arduino on Android


Sensor reading from Arduino can be read on your Android device with Bluetooth module. You can display this sensor data on the beautiful gauges. We need some software and hardware carpentry to pull this through. Here is the screenshot of the temperature reading measured using the Arduino UNO on the Samsung 10.2 tablet. You can have multiple sensors and display using gauges on Android device.




Things You Need

A JY-MCU bluetooth module


A temperature sensor (TMP 35)


Arduino UNO


Connections on Breadboard



Arduino Sketch

Open the Arduino and copy the following code into it.
Create a new sketch and copy the following code.

const int temperaturePin = A0; 

void setup()

void loop() 
float voltage, degreesC ; 
char message; 

voltage = getVoltage(temperaturePin); 
degreesC = (voltage - 0.5) * 100.0; 

while (Serial.available() == 0); 
message = Serial.read(); 

float getVoltage(int pin) 
return (analogRead(pin) * 0.004882814); 

Explanation of the above code is like this.

For JY-MCU Bluetooth module, we need to setup the baud rate of 9600. Remainder of the code is setting up the temperature sensor on A0 pin and reading voltage. Voltage is further converted to the temperature in degree Celsius. When message is received from the Android device, android sends the temperature value over the serial.

When a message to read temperature is received from the Android device, Arduino sends the temperature value over the serial port to Android. Connect Arduino to your machine and upload the sketch to it.

Android Setup
We will be using Eclipse and Windows platform to create the app for your Android device. Before getting started become familiar with “Hello World” tutorial of the Android. This tutorial will also help to install Eclipse, Android device driver and Android installation on your Windows machine.

For Bluetooth communication between Android devices Arduino we will use tBlue library from Arduino Bots and Gadgets book from Make. TBlue library is available from here.

Connecting to Arduino from Android

With tBlue library connecting from android is very easy with command,

tBlue=new TBlue("XX:XX:XX:XX:XX:XX");

where Bluetooth address of the Bluetooth module is provided in the quotes. Easiest way to get MAC address of your Bluetooth module is to power up Arduino, enable Bluetooth mode from Android and connect to it with default password provided by manufacturer. Install the BluetoothScanner app from Google play store on Android to know the MAC address of the paired Bluetooth module.

Once Bluetooth module on Arduino is connected to the Android device, reading the data with tBlue is very easy with this command.

String s = tBlue.read();

Sensor data received in the string is further converted to a number and displayed in the gauge with the GaugeView library. Sending data to Arduino over Bluetooth can be done with command



GaugeView Library for Android
Download the GaugeView Library with demo project from Github. In next step we will customize this project.

Customizing GaugeView Demo Project in Eclipse
Open Eclipse and go to File > Import > Android > Existing Android Code into Workspace option. Click Next and select GaugeView Demo project as root directory.

Open the src folder in GaugeView Library, copy GaugeView.java file and paste into src.org.codeandmagic.android.gauge.demo folder of the demo project.

Correct the package name in the library as,

package org.codeandmagic.android.gauge.demo;

Create a new class TBlue.java and paste code from tBlue library from here. Expand res folder and copy the images from drawable folder of the GaugeView library to drawable folder of demo project. Similarly copy the arrays.xml and attrs.xml files containing color ranges to values folder from the GaugeView Library.


Modify the Default GUI in GaugeView Library
Open the activity_main.xml file in layout folder and add a button tag in layout file to measure the temperature form Arduino. Paste the following lines inside the button.

android:text=”Measure” />

Also write to create a text box to indicate the message when Bluetooth module is connected to Android.

android:text=”Small Text”
android:textAppearance=”?android:attr/textAppearanceSmall” />

Also change the unit in layout file to the desired one by using a string variable.


Here we used degree Celsius for temperature. To do this add a string variable in string.xml file values folder.

<string name=”tempUnit”><sup><small>o</small></sup>C</string>

Modifying the GauageView Demo Project
Open the MainActivity.java and import the additional packages for textView and View

import android.widget.TextView;
import android.view.View;

Also add the following variables

TextView messagesTv;  
TBlue tBlue;  

In the oncreate method, provide the id of the gauge1, gauge2 and text message viewer same as your layout file. Also provide the id of the Bluetooth module and exception handing code which prints messages in LogCat window of Eclipse.

mGaugeView1 = (GaugeView) findViewById(R.id.gauge_view1);
mGaugeView2 = (GaugeView) findViewById(R.id.gauge_view2);
messagesTv =  (TextView)findViewById(R.id.textView1);  

tBlue = new TBlue("xx:xx:xx:xx:xx:xx");  
		if (tBlue.streaming()) {  
            messagesTv.setText("Sensor Connected successfully! ");  
        } else {  
            messagesTv.setText("Error: Sensor Failed to connect. ");  

Also remove the timer code


Permissions for Bluetooth Communication

Open the AndroidManifest.xml file and add the following two lines to allow Bluetooth communication as highlighted in the screenshot.



Running the Android App

Follow these steps to install and run

  • Power up the Arduino with Bluetooth module and also enable Bluetooth on your Android device
  • Connect to Bluetooth module from Android by entering the password provided by the Bluetooth module manufacturer
  • Connect your Android device to Windows machine
  • Go to Run > Run configuration > Target tab to run the app on connection device instead of Dalvik Virtual Machine
  • Run the project to install and launch the application on the Android
  • Click on measure button to display the temperature in the room on gauge

Get completed project from here.  

Starter Kit for Arduino

Which kit to start with Arduino ?

When searching for Arduino, I noticed that market is flooded with starter kits and it takes quite some time to find the good starter kit.

Ultimate Starter Kit from Vilros

I finally settled for the Ultimate Starter Kit from Vilros and sold on Amazon. This kit is a good value and comes with a very good tutorial book from the Sparkfun. In less than a day, I was able to do all tutorials covering LEDs, speakers, photo-diode and music. Except motors everything worked fine in this kit. Still it is a flimsy kit and Arduino UNO board does fit correctly in the plastic fixture provided with it.

Fritzing Creator Kit
This is an ultimate kit which I suggested to a Friend who bought it and used it for his kids. This kit comes with storage box and it is a great kit to start with Arduino. It does comes with book and contains even more items such as paper models of dinosaurs and robot. It is more fun and systematic kit especially for kids. Get it from Seedstudio website. Here is a video which shows the kit.