This blog is the first installment of a review of the Ultimate Raspberry Pi Bundle provided by element14. In this review I will focus mainly on the video application I proposed that prompted element14 to so generously provide the comprehensive bundle. This first picture just shows how comprehensive the bundle is.
I play about 72 softball games every year (5 different leagues) and I take pictures of the action when I'm not on the field. These pictures get shown at banquets and sometimes on web sites. I try to take pictures of every player so nobody is left out when the slide shows are presented, but I cannot take pictures while I am batting or playing on the field, so I cannot take pictures of every play or every player.
The Solution Concept
This project involves building an automated video camera that can capture every player as they bat and the play at first base after a hit. To do this, the camera will be located over the fence half way between home plate and first base. The camera will be normally pointing at the batter's box and when the system detects a hit (by the sound of the bat hitting the ball) it will wait a short time for the batter to start running and then pan the camera to capture the play at first base. After 20 or 30 seconds the camera will return to capturing the action at home plate.
Operating a servo motor and capturing video from the PiCam are nothing new for the Raspberry Pi and I don't expect too many issues getting these functions working. Mainly it will require learning how to use the existing resources available for Raspberry Pi. There are 2 significant challenges though:
- Unambiguously recognizing the sound of a bat hitting a ball and wirelessly sending a trigger signal to the camera module will require careful design and lots of experimentation because there are many different types of bat and a significant variety of hit sounds and of course there are many different sounds that need to be ignored as well.
- The camera system will need to be in a position where it could be hit by the ball so the system needs to be able to survive a massive impact. Protecting the electronics is plenty hard enough, but protecting the panning drive train may be even tougher. This is a difficult challenge, given that I do not have a large budget and I do not want to lug around a huge apparatus. The enclosure will not only need to protect from very high g accelerations, it will also need to prevent the electronics from getting wet when it rains. Solving these requirements may cause issues with heat build up as it will be hard to conduct heat away from the highly protected interior.
Given that the timeframe for publishing this review ends before the summer softball season starts, I will not be able to test the audio detection circuitry under all conditions, but I will try to get some representative sound triggers.
Design and Hardware Considerations
The system needs to be battery operated so I have procured a 5 volt, 3.2 AHr lithium battery. The Raspberry Pi really needs a display to show video, so I procured a 3.5 inch composite video LCD with a resolution of 640 x 480 for about $18. This display requires 9-15 volts to work, so I procured a DC-DC converter module to boost the battery voltage.
To provide the panning function I procured a high torque servo motor.
Progress and Status
By following the extensive on-line examples and literature, I have:
- Installed and updated the Rasbian operating system
- Tested the wireless keyboard/touchpad that came with the XBMC package with the RPi and a TV-android box - it worked great with both systems
- Installed the Wi-Pi wireless module - it took a couple of attempts because I didn't remember that my wireless router uses WPA2 and PSK.
- Installed the PiCam and took both stills and video - it is a pretty good little camera
- Configured the composite output to work well with the 3.5 inch LCD. At 640 x 480 the text is just legible but I set it up for 440 x 300 to make it easier to read.
- Assembled the 16x2 LCD Pi Plate Kit - I may not end up using this module on this project, but wanted to see if there were any issues with it. If I do use it, it will need to be mechanically robust, so I wanted to solder the LCD connector and mount the LCD on standoffs. The standoffs were not supplied, but I had some 3/16 inch standoffs that worked well. I used nylon washers on the underside of the Pi Plate for better insulation against the screw heads shorting traces that are underneath the screw heads. I tightened the standoffs with the connector loosely in place and soldered the connector after the LCD was locked in position to minimize stress on the connector solder joints.
This second picture shows the Pi Plate LCD assembled and mounted on the Raspberry Pi. It also shows the Wi-Pi module and the PiCam (in an anti-static dust-cover). Raspbian is running and displaying on the small monitor I purchased as a mobile display. The photo is not edited other than resizing, so you can see the small monitor has pretty good colours and at the chosen resolution is very readable. In the SoftballCam this monitor will be a video display (large by videocam standards) as well as an operating system display.
- I tried several different power supplies before I found one that would run the RPi plus peripherals plugged into the RPi USB ports. They all seem to run the CPU card okay, but wouldn't supply enough consistent power to run a mouse. I think it is an issue with instantaneous current - the average current drawn by the RPi is not large, but there seem to be peaks that can momentarily cause some power supplies to sag, particularly if the USB cable has significant impedance.
- The display I bought was intended for vehicles and it only turns on when a valid composite signal is present. This is not a problem now that I know about it, but initially it didn't seem to be working, because the RPi wasn't generating composite video before the operating system was properly installed.
I am still waiting for the microphone I ordered to arrive and the associated wireless link.
I am designing the microphone signal processing circuit.
I have some of the packaging and mechanical configuration figured out, but still struggling to keep costs down.
I want to try making the servo program - it can be a completely separate task from the video capture.
So far, the Raspberry Pi eco system is proving to be a bit more complicated than I had expected and often the documentation is not robust enough to avoid a lot of auxiliary web researching and trial and error. However there is a lot of information available on the net and it is satisfying to continue up the learning curve towards a successful project.