Important news about HackSpace

We have some important news to share about HackSpace: Issue 81 was the last issue of HackSpace as a standalone magazine, and HackSpace has become part of The MagPi, the official Raspberry Pi magazine. Starting with issue 145, We’ll be adding pages to The MagPi to make room for the stories and tutorials you’ve come to expect from HackSpace.

Can I Hack It? - Bubble Machine

By Les Pounder. Posted

Are you tired of blowing your own bubbles? Do you yearn for the Internet of Things (IoT) to provide you with bubbles on demand? Well, your automated bubble blowing days are here!

For just £2, we have found an extremely hackable bubble machine that can be used with Raspberry Pi, Arduino, ESP8266, etc. to give you bubbles on demand. So let’s take a look inside it and see what we can hack!

Coming in a two-part plastic frame, the bubble machine is made from easily worked plastic. In fact, the plastic is a little thin in places, so take care! Measuring 185 mm tall, 130 mm wide, and 75 mm deep, there is plenty of space for your creation.

The frame is held together with six cross-head screws, all of equal length; when they are removed, the front and back sections are clipped together with small connectors around the perimeter. When unclipped, the two frames are tenuously held together by wires from the battery compartment.

In fact, when we pulled ours apart, we broke one of the wires, but it was easy to solder back on. Inside the bubble machine we have another plastic section, a trough that holds the bubble solution, and a top cover. This provides a barely adequate level of water resistance, but some hot glue would be useful here.

The two-part case means we can easily gain access to the spacious insides and the electronics within

Electronics

Powered by three AA batteries, providing 4.5 V of power for the on-board DC, the bubble machine is electronically simple.

Power goes directly to the motor, but along the way, a locking push-button is used to close and open the Vcc side of the circuit.

The DC motor is contained in a small, black plastic housing inside the front frame. There are two cross-head screws to remove before the motor is free of the frame.

You will also need to remove the circular ‘wand’ used to blow bubbles, as this is connected to the motor via a hexagonal shaft. A third screw is located on the reverse – take care when unscrewing, as the DC motor has a number of gears that will pop out once opened.

The DC motor is a generic cheap DC motor, like those found in really cheap motorised toy cars. In fact, when the motor is running, you can smell the faint ‘burning’ smell of it, just like those toy cars.

The motor is used to spin the wands that will hold our bubbles, and to power a small fan that will blow<br>
the bubbles!

Hackability

For £2, this is an awesome cheap project to hack.

Firstly, we have so much space inside the case. There is enough space for a Raspberry Pi Zero W and a motor controller – we tried the L298N controller to directly control the DC motor. All we needed were a few wires from the Pi to the L298N and some power.

Sure there is a 3 × AA battery holder on the board, but we chose to make a small hole in the battery box and feed in a 5V, 2A power supply for the Pi and motors. It was then just a case of controlling the motors using the GPIO of the Pi via the L298N.

This is an ideal introduction to IoT-based projects. Sure, the plastic frame is a little thin, and the ‘waterproofing’ needs a little hot glue to ensure your electronics survive. But you have an ideal cheap entry to IoT projects. The cavernous space inside the machine means we can hide everything away to create a simple-looking device.

The on-board battery pack provides 4.5 V, which can be used with a voltage booster (like Adafruit’s PowerBoost board) to provide 5 V for your chosen board and motor controller. Time to get hacking!

The Nitty-Gritty

The Internet of Things has been with us for some time now, but you would be forgiven if you thought that it was not within your reach. We need data centres, clouds, and top coders, right? Well, no, we don’t.

Take our bubble machine for example. We need just a Raspberry Pi Zero W computer, which costs $15. Then we need a motor controller which, for an L298N, is around $3 online. A 5 V, 2 A power source is next, which retails for around $10 for a good supply.

Then we need to wire the L298N to the 5 V power supply, and also power the Pi Zero W from the same supply. Connect the two GPIO pins on the Pi to the inputs on the L298N, and then connect the outputs of the L298N to the motor terminals.

A quick test in Python to turn the GPIO pins on and off will confirm that the wiring is complete. Then, we just need to trigger the machine to life with IoT – for that, the simplest route is Twitter.

We used Node-RED to make a simple app that scans Twitter for our chosen hashtag; when it sees the latter, it will turn the correct GPIO pins on and, in turn, spin the motor for ten seconds, before returning to wait for the next trigger.

The trigger can be Twitter, MQTT messages, HTTP POST, etc., but all of it can be done with a Raspberry Pi and under $30 of equipment!


The Bubble Machine was bought for £2 from Poundland in the UK, but alternatives are available from online retailers.


http://bigl.es

From HackSpace magazine store

Subscribe to our newsletter