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?

Updated Rainberry Design

After purchasing Prusa i3-mk3 3D printer, I could now do more design iterations and improve the Rainberry camera case design further.

Both Pi Zero W and Pi 3 cases are improved with 3D printing tolerances for appropriate fits and top part radius. Additionally, a seal for power cable is now added to reduce water ingress from bottom part of camera.

A different glass of 18 mm and 1.5mm thickness is used in this design, as previous 17.9mmx1.2mm glass is now discontinued.

Updated Design Download Links

Overall dimensions of the Pi Zero W case

92mm x 67.5mm x 26mm

Rendering of Pi Zero W case

This slideshow requires JavaScript.

Overall dimensions of the Pi 3 case

100 mm x 117 mm x 26mm

Rendered Images of Pi3 case

This slideshow requires JavaScript.

3D Print Settings

  • Bottom part – 0.2 mm with supports and 20% infill
  • Top part seal – 0.2 mm and 20% infill
  • Seal – 0.2 mm and 20% infill
  • USB cable seals – 0.1 mm, 100% infill, slow speeds and supports

Pi Zero W case parts after 3D printing


Assembly Process shown for Pi Zero W

  1. Put O-ring and glass in the top part of the camera caseIMG_9438.jpg
  2. Put screws in the seal.IMG_9440.jpg
  3. Put seal on the top part of the case and screw it. While tightening screws, press the seal on the case slightly to compress the rubber seal down.img_9443.jpg
  4. Next, place Raspberry Pi Zero W in bottom part of case and tighten the mounting screws.img_9441-e1529179067883.jpg
  5. Place camera on the seal and tighten the screws. Put the cable through the opening and insert into Pi.IMG_9448
  6. Put top part and flip it over to put 4 screws in place.img_9449.jpg
  7. Put the USB seal upper and lower half. Tighten using M1.6 screws.img_9451-e1529179321960.jpg
  8. Finally put the screw in the mounting bracket in the caseIMG_9469

Part List

  • Parts from McMaster.com
    4-40 Thread, 3/4″ Phillips flat head, total 4 (91771A113) for case
    4-40 Thread, 3/16″, total 4 (91772A105) for Pi
    M2 Size, 5MM, total 4 (92000A012) for Pi camera. You can also use M2 if tight.
    M1.6 Size, 4MM, total 6 (92000A002) for glass seal and USB seal
    O-Ring, 13mm id, 1.5mm (5233T39) for seal
    O-Ring, 1.5mm, 1ft length (1187N11) for case and Shrink wrap (6855K14) for USB cable
  • Glass piece 18mmx1.5mm, from Aliexpress.com. Search for flashlight glass in aliexpress.com in case of problem.
  • Swivel mount from Videosecu with 1/4 inch threads

Prusa i3 MK3 3D Printer !

After waiting for two months and two weeks, I finally received the Prusa MK3 i3, fully assembled 3D printer. I always wanted to own a 3D printer to quickly test designs and print trending designs on Pinshape or Thingiverse or Myminifactory.

In the past, I used Shapeways and local 3D printing companies a lot for verifying the designs. My first 3D print was a dollhouse flower shaped fan and I was overjoyed after seeing the model in reality. However, it costs a lot of time and money, even for small parts when using 3D printing vendors. Iterations for parts with fitting take even more time and money. In short, I badly needed a printer to keep designing and testing new parts.

Initially I was not sure of amount of effort required in using and maintaining the 3D printer. Browsing through reddit/3Dprinting section, one can see a lot of posts highlighting issues faced by users and fixes from the community. On reddit, Prusa is always in top of the list of recommended printers. Other two printers considered by me were Lulzbot or Ultimaker. But finally placed an order for Prusa considering so many new features released last year, enthusiastic response from 3D printing community and large fan base of the printer.

Here are some snapshots of the printer from unboxing to some sample and cool prints from the Myminifactory.com.

Yey finally here!


Printer came with a test print and calibration summary. It was very well packed and overall great job by packaging team.



Everything OK here check check…



Best part of the packaging was the Haribo candy, operating manual and toolkit required for printer. Sorry no picture of candies, kids and I ate them right away :).


I could print directly out of the box after cleaning the bed with iso-propyl alcohol cleaning pads. Prusa comes with sd cards with pre-sliced gcode files of various models which can viewed here. To start with I printed this Batrang.


Here is the calibration cube close up with 0.2 mm layer height. Print came out well with sharp corners captured.


Measurement in X direction.


Measurement in Y direction.


Measurement of height.


After this, I printed flurry of models for my daughter. Here is a cool print of musical note pendent.


A pencil and pen organizer to keep desk organized. It took four hours to print this but worth it.


Owl earrings came out neat.


When printing tiny parts, I found that it is best to reduce the print speed and use small layer height. Brims and supports help a lot for small model for better adhesion and avoid print failure.

On second day, I did face some issues with first layer adhesion. After digging through reddit, found that isopropyl alcohol (91%) and keeping filament dry was the best solution for most first layer adhesion problems. So immediate purchase after buying the printer was an airtight Sterlite container with seal and silica for keeping the filament dry. After that I faced no issues with first layer adhesion.

Only last remaining thing on wishlist is to purchase a strong and fire resistant enclosure.

Music Activated LED Hat

Do you have kids learning music? This project is certainly cool way of introducing them to make projects with wearable electronics.

Adafruit has a nice example of lighting LEDs triggered with voice called Ampli-Tie. There are some variations of it on different kinds of clothing. Here I used it for a hat for my daughter who is learning piano.

We took an old hat, cut holes, put metal rivets from Hobby Lobby for LEDs. Adafruit Gemma was used here and everything was soldered with wires. Finally stitches were used to hold the circuit in place.

RainBerryZ and RainBerry3 Outdoor Cases for Raspberry Pi Camera

After a long hiatus, I was able to create two more versions of original weatherproof case for taking Raspberry Pi camera outdoor, RainBerry for Raspberry Pi Zero W and Raspberry Pi 3.

They are available on PinShape and 3DExport.

  • RainBerryZ for Raspberry Pi Zero W – Get it here Pi Zero.
  • RainBerry3 for Raspberry Pi Zero 3 or 2 – Get it here Pi 3

Downloads are available on 3DExport,

If you do not have 3D printer like me, you can order them from 3DHubs, Shapeways, Sculpteo, i.materialise, MakeXZY or your local public library.

Here are some snapshots of RaspberryZ.


Placing screws in the seal holes before assembling in the case. seal-assy

Than place the seal ring of camera opening followed by place glass cover. Finally put the camera seal and then tighten the screws. Put the seal around the side grove and cut it to fit all sides.


Top case with rubber seal of glass and camera seal holder assembled.IMG_2395

After assembly of camera


Fully ready to roll !



Image from the camera, please ignore the mesh screen in the window.


Here are RainBerry3 Snapshots. Case is slightly big to accommodate the bluetooth and maintain square shape.


small-camera-Pi-3 v30-v6

Top case with glass, O ring and o ring assembled in the side groves. IMG_5430

After camera is assembled with M1.6 Size, 4MM. I found it is much easier to use them than M2 Size, 5MM ones which fit tighter.


Ready to roll !


Finally all 3 cameras. Hurrah !


It uses same screws and mounts as RainBerry earlier version.

  • Parts from McMaster.com
    4-40 Thread, 3/4″ Phillips flat head, total 4 (91771A113) for case
    4-40 Thread, 3/16″, total 4 (91772A105) for Pi
    M2 Size, 5MM, total 4 (92000A012) for Pi camera. You can also use M2 if tight.
    M1.6 Size, 4MM, total 6 (92000A002) for seals
    O-Ring, 13mm id, 1.5mm (5233T39) for seal
    O-Ring, 1.5mm, 1ft length (1187N11) for case and Shrink wrap (6855K14) for USB cable
  • Glass piece 17.9mm x 1.2mm, from tinydeal.com (HLD-242646) or dx.com (SKU: 10640)
  • Glass piece 18mmx1.5mm, from Aliexpress.com. Search for flashlight glass in aliexpress.com in case of problem.
  • Swivel mount from Videosecu with 1/4 inch threads

Thank you for your all support and number of requests for new versions.

Get them from links below and get it printed.

  • RainBerryZ for Raspberry Pi Zero W – Get it from PinShapeZero
  • RainBerry3 for Raspberry Pi Zero 3 or 2 – Get it from PinShape3

Raspberry Pi NoIR Camera with IR Cut Switch

Raspberry Pi NoIR camera is same as Raspberry Pi camera, except it has no IR filter. I was exploring an option of using IR cut filter switch with Pi NoIR camera. This is commonly done in security cameras, where IR cut filter is used to take pictures during daylight and removed during nighttime with switch. There is a nice video showing operation of it in Dropcam.

I used a simple IR cut filter switch from Aliexpress.com. This switch works well and tested it by simply reversing the power supply. I took pictures of the same object with and without IR cut filter. If you want to use automatic polarity switching using Raspberry Pi there is a help topic available here.

How I Designed a Compact Weatherproof Raspberry Pi Camera Case

Motivated by the video, Militarizing Your Backyard with Python, I was tinkering with Raspberry Pi for Squirrel recognition to protect my garden bustling with sweet peas and tomatoes. As a step towards the goal, I started first programming Raspberry Pi A+ with OpenCV and then emailing me the face of any person intruding in my backyard. However I found no suitable Pi case in the market which is compact, weatherproof and has elegant look. Fake security camera case sold on Amazon was quite cheap but broke easily. It made me to think towards designing a compact case which can be used outside to monitor the backyard garden and get alerts.


I sat down and sketched the general shape of case on back of a scratch paper. Here is how my sketch looked. I chose to stick with Square shape, though Pi A+ is a rectangular shape.


Sizing the Case

With no experience in designing plastic parts meant watching tutorials from YouTube and learning from the iterations. It took one month for me to become familiar with tools. I broke down the design work several intermediate goals, beginning with obtaining the dimensions of Pi A+, Pi Camera, WiFi adapter and micro USB power cord. Vernier with LCD display manufactured by General Tools was very handy for this work. Ubiquitously available CAD models of Pi and Pi camera also helped to verify the clearances in the design by importing them and assembling with the designed case. Many thanks to the effort by several community members of GrabCAD.


Next step was to size and fit all the parts in the given space. Mounting Pi A+ with SD card and WiFi adapter in the case was easy. Mounting the Pi camera above Pi in as small as possible was a little difficult. I chose to mount camera directly on the top case since the data cable of Pi is flexible.


Weatherproofing method of cellphone or electronic case is pretty standard and based on using a weatherproof seal around the case. It was not difficult to split the case into two parts and then add the groove for holding the seal. Similarly seal of the glass is hold together by the seal holder attached to the case. It compresses the seal and hold it in the place.

Designing of screw bosses was a totally new area for me. I could not find any reliable information source and resorted to plastic part design guidelines from several plastic manufactures and handbooks. I am providing the details of the one from the book, Injection Mold Design Engineering by Davide Kazmer. Suggested size of d was 88% of D.


I used FDM method for 3D printing in ABS plastic due to limitations of escape holes of SLS printing. This is how the camera looks after final design, 3D printing and assembly.


Weatherproofing Test

I tested camera in rain for more than 2 hours and no water entered in it. Here is the picture of it in rain.


After the test in thunderstorm, I opened the camera to see no water in case.


3D Model and BOM

You can view the 3D model and 3D print it from Pinshape. If you do not have the 3D printer then try finding a 3D printer on makexyz.com in your area and use it to print.

Models also available for new versions of Pi3 as described in this recent post and can be downloaded from Pinshape links, Pi 3 and ZeroW.

Camera Parts

  • Parts from McMaster.com
    4-40 Thread, 3/4″ Phillips flat head, total 4 (91771A113) for case
    4-40 Thread, 3/16″, total 4 (91772A105) for Pi
    M2 Size, 5MM, total 4 (92000A012) for Pi camera
    M1.6 Size, 4MM, total 4 (92000A002) for seal
    O-Ring, 13mm id, 1.5mm (5233T39) for seal
    O-Ring, 1.5mm, 1ft length (1187N11) for case and Shrink wrap (6855K14) for USB cable
  • Glass piece 17.9mm x 1.2mm, from tinydeal.com (HLD-242646) or dx.com (SKU: 10640)
  • Glass piece 18mmx 1.5mm from Aliexpress.com, since 17.9 mm is not available.
  • Swivel mount from Videosecu with 1/4 inch threads

Here is the timelapse video recorded with this camera.

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.

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.