Disclaimer: I’m an engineer, not a pro film maker. Be advised.
Disclaimer: I’m an engineer, not a pro film maker. Be advised.
Raspberry Pi cases are all the rage. Everyone makes blocky cases, wood cases, cases shaped like computers or arcade cabinets. I wanted a case that could interact with the physical space around it-- why not put a Raspberry Pi 2 in a ball?
Here are just a few things I can do now--
- bowl with it
- wirelessly connect to the Internet
- draw in 3D space with motion tracing
- automated bounce counting
Meet the Pi Ball!
Here were my requirements
- Use a Pi (Raspberry Pi 2 in the case)
- Spherical case, that can be bounced, kicked, thrown
- Accelerometer onboard to monitor the motion of the ball
- Wireless everything! Wireless keyboard/mouse, networking, sound and video
(Pi Ball in on! LEDs on! Wirelessly connected to the screen in the background - running the accelerometer tracking program.)
Project by sections
The Pi Ball enclosure:
The Pi Ball spherical enclosure consists of three pieces. Two hemisphere and the mounting plate attached in the middle.
(The 3D model of my concept. I used Solidworks 2013.)
I wanted a smooth external appearance. No screws/bolts holding it together.
(Here is the freshly printed enclosure components. A Pi 2 place on the mount plate for scale.)
(Pi Ball parts layout. Had to stuff all that inside the enclosure!)
When the hemisphere lock together, they wedge the mounting plate in the middle. The hemispheres are made of “elasto-plastic” from Shapeways, and the mount plate is regular ridged ABS. The Elasto-plastic shells were quite bouncy – when empty. However, with all the components inside, the high bounce was gone.
(The mount plate, Pi 2 attached using four M2.5 cap head bolts)
The middle mount plate has slots for passing wires and such, and the Pi is attached to the plate via standoffs printed on the surface. Those standoffs were tapped for M2.5 bolts.
(Pi Ball, early Raspberry Pi 2 mount and wire routing.)
Making everything wireless turned out to be very easy with today’s tech. Wireless keyboard and mouse adapter was a single low profile USB transceiver. The WIFI adapter was exactly the same. The wireless HDMI comes via a Nyrius AERIES 1080p transmitter. (The HDMI receiver is attached to the screen. The one I used had a 165 foot line-of-sight range. But, I found that I could get about 90-100 feet without issue.)
To stay wireless, the devices need power. I used two onboard battery packs – for two different, but critical reasons.
ONE – The HDMI adapter needed 5V@ 1.5A, so to take the strain off the main battery I found a small 2200mAh external battery. Tool the enclosure off of it, and placed it on top. The Pi and the LEDs shared a 8400mAh external battery supplying 5V@ 2A.
TWO – The two separate batteries created a better balance inside the sphere. So, it rolled more like a ball than an egg.
(Almost everything attached to the mount plate. Pi2 on top with the HDMI transmitter and 2200mAh battery (not shown). Bottom has the 8400mAh battery, USB hub, and accelerometer (not shown) )
(NeoPixels on, via their own power source.)
The Adafruit NeoPixel LED strip needed to source more power than the Pi 2 could supply. So, I connected them to their own USB cable connected to the 8400mAh battery directly. Only the signal life from the NeoPixels connected to the Pi 2 (pin 12 to be exact)
(About to close up the Pi Ball...)
(Pi Ball is on... running the accelerometer sensor program - wirelessly connected to that LG TV.)
(The 2200mAh battery removed from its red case. This way it was much smaller to put on top of the HDMI adapter.)
The HDMI adapter on the 2200mAh battery was what gave out first. It lasted 3 hours of constant streaming. I could have easily doubled that with another 2200mAh battery, there was room.
For the Pi 2 itself. the 8400mAh battery lasted about 12 hours of intermittent use. But, after 3 hours I did not have video output. That may have extended the life.
Software (all in Python):
Aside from running the full OS, where one could do regular computer work, tinkering, etc.. I had two specific Pi Ball applications.
- An on screen representation of the Pi Ball’s location and movement in an isometric representation on 3D space. It looks like a fading comet trail. I also put in a mode to trace the movement. My idea was for someone to hold the ball and draw in 3D. However, it only partially worked. I need to change it to take more samples.
- I also had a mode to count the # of impacts detected, like bouncing.
- The second feature was turning on LEDs inside the ball. The main feature was to react to the accelerometer data, and turn on, flash or chaser effects on one of those Adafruit Neopixel LED strips. This worked spotty at best. But, when it worked, it did what I wanted.
(I have an always on, always off, a constantly flashing/chasing, and accelerometer effected modes.)
- All the USB cables used inside the Pi Ball had copious amounts of rubber/plastic on the connector ends. I used a knife and shaved off the excess to make them more flexible and smaller.
(Here is an example of cutting off wire thickness. This is the shaved HDMI cable. I also took some of the rubber shielding on the length to make it more flexible.)
- Fitting everything into the Spherical case. Perhaps if I make a version 2, I will up the size from 6” diameter to something like 8 or 10”. That way I could pack in more sensors and effects.
- Getting the Neopixels to work. Sometimes they would flash random colors or effects. They are dependent on the frequency output of the Pi. I stuck with a white only color to just get it to work.
Schematic and Design
The only true schematic, is the accelerometer connection. See below:
Everything else is just standards. IE, plug in mouse/keyboard to the USB port, etc
(See attached to the post)
|1||$35||$35||element14||68X0156||Raspberry Pi 2|
|1||$37.00||$37.00||element14||45P6651||ADXL335 accelerometer and parts kits|
|1||$2.19||$2.19||element14||19C7200||ANALOG TO DIGITAL CONVERTER ADC|
|1||$220.00||$220.00||Shapeways||NA||3D printed components|
|1||$48.00||$48.00||Amazon||NA||Logitech wireless keyboard and mouse|
|1||$8.00||$8.00||Amazon||NA||WiFi adapter (generic)|
|1||$200-400(new)||$200.00||Amazon||NA||Nyrius wireless HDMI adapter (Pro model)|
|1||$25.00||$25.00||Adafruit||1461||NeoPixel 60 LED strip|
|1||$4.49||$4.49||Amazon||NA||Jgmax 2200mAh external battery|
|1||$19.00||$19.00||Amazon||NA||Anker 8400mAh external battery|
Other uses of the system
Aside from having a completly wireless Raspberry Pi 2 system, the Pi Ball could be used for any number of applications - Imagination is the limit.
- In its current form, it can be used for motion tracking.
- I have a mode that lets the user draw in 3D space, tracing the motion.
- Count the number of bounces.
- Any number of light based effects.
- Roll it in, let the fun begin! Use your imagination...
When I have more time, money, or people really like the Pi Ball
- Source cheaper components. For instance, the accelerometer. The Wireless HDMI adapter could be bought elsewhere. The 3D printing could happen in house.
- Make a new version with more internal hooks. I designed in only 4 attachment points between the two hemispheres. I would want to increase that to at least 6.
- Better battery design and mounting.
- Bouncier all around. I want to bounce it like a basketball, personally.
- More software and code to use the ball to the utmost.