Raspberry pi bubble machine

It was made mostly because I had the parts laying around and I wanted to make something my son would enjoy. The reason for using a Raspberry pi zero is because I have a few of them laying around. Two main reasons for why this is a bad setup, battery consumption and having to ssh into the pi to start the program unless it's setup to run on startup.

A better board to use is something Arduino or NodeMCU based. Good reasons for using a Raspberry pi is if you wish to setup a web application to control it with.

With the wiring, batteries and container for fluid it looks kind of suspicious. I have been advised to not bring it on a plane, I intend to follow that advise.

Front Back

It's a quite simple program written in python3. Not much is needed to control the servo and relay.

 1from gpiozero import AngularServo
 2from gpiozero import LED
 3from time import sleep
 4
 5#setting up servo and fan.
 6servo = AngularServo(4, min_angle=-90, max_angle=90)
 7fan = LED(17)
 8bubbleWand = -90
 9
10while True:
11    bubbleWand = -90
12    servo.angle = bubbleWand
13    sleep(0.5)
14    #This for loop is used to slow down the servo.
15    #Previously it threw the bubble mix all over the place.
16    for i in range(19):
17        servo.angle = bubbleWand
18        print(bubbleWand)
19        bubbleWand += 10
20        sleep(0.1)
21    #starting the fan
22    fan.on()
23    #giving the fan time to blow some bubbles.
24    sleep(2)
25    #shuting the fan off.
26    fan.off()
27    #Giving the fan some time to spin down.
28    #It does not work with this design if the fan is always on.
29    sleep(2)

Simple diagram I made using Fritzing

Connection diagram
Parts list:
  • 1 x Raspberry Pi Zero
  • 1 X MG90S Servo
  • 1 x 3V to 6V motor
  • 1 x 5V Relay board
  • 1 x 5V 2.1A powerbank
  • 1 x 3.6V 2000 mAh 18650 battery

The reason for the extra battery is that the motor uses more power than what the powerbank is able to supply via the USB. The Raspberry shuts of the instant the motor starts and everything stops while it reboots.

This is one of my older projects which I shared on Github a good while back. Reason for adding it here is that I wanted get more known with Markdown and this website setup.

Translations: