Welcome to the sixth and final blog post, in the series to support the Raspberry Pi Zero 2W Roadtest. The blog posts will explore different aspects of the product while attempting to engage the E14 Community members. Comments and questions to the blog posts are welcomed and encouraged. The blog posts will serve as the resources for assembling the RoadTest Review document.
The project objective is to pair a Raspberry Pi Zero 2W with a camera, assemble it on a HO scale model railroad car with a power source and stream or record video of the train in motion.
I will start the post with a video that was one of the deliverables from the application. The content shown is recorded as the Pi camera assembly is being moved by a locomotive. The assembly can be pushed or pulled by the engine.
PiZero2W can ride the rails and deliver video! Four separate videos are spliced together. A side view from the traincam, a front view from the traincam, a front view from an iPhone and another iPhone video shot.
The model railroaders and myself were surprised at how smooth the actual ride of the camera was. We were expecting the camera to be shaking, making for poor video quality as the well car moved along the track. This did not happen. The assembly, mostly hidden by container cars doesn't obstruct any movement on the layout. Positioning the camera for different video shots of the layout was something the model railroaders really took to.
Prototype Assembly
The model railroaders modified a HO scale well car to hold a battery and Pi with camera assembly. A servo motor to reposition the camera was a feature added during development.
{gallery}Pi Railcar Prototype |
---|
Two rail cars supporting the PiZero2W camera system |
GPIO connector cable assembly |
Great plastic work by the modelers |
camera system hidden insider container car |
battery hidden inside rail car |
power off button painted to blend in with rail car top |
camera mounted on servo motor to facilitate movement |
To hide most of the load, container boxes were modified to cover the electronics. The final fitting of all the components inside the container cars made for a tight fit. Support frames inside the cars were carved away to enable the housing to cover the assembly. The USB power cable diameter was large in order to ensure a sufficient gauge wire. The cable was difficult to position. An exact knife was needed for trimming away plastic to achieve a fit.
Late in development, a need for a method to power down the PiZero2W was determined. A push switch was integrated into the container box that covers the Pi. Pressing the switch triggers a python power shutdown routine script.
Prototype Wiring
One of the challenges of the project was to determine how to supply power. The normal USB mini-B connection provided on the Pi couldn't be used because of space limitations. A wiring harness was developed using six pins.
Power from the battery & ground is inserted on pins 4 & 6 of the Pi. Pin 8, GPIO14 is the servo data input. Pin 10 GPIO 15 is the power off trigger generated when the button is pressed. The button connection uses a connector to allow the container box to be separated.
Two python scripts were developed. One to control the servo position and the other to initiate a power shutdown when the button was pushed.
The PiZero2W was configured to connect to a Wifi router. Connecting to the Pi console from a laptop, commands were issued to generate the video that was displayed on a Linux laptop. It was possible to display the video on the laptop with both the Pi and laptop using a wireless connection. At times this resulted in latency that caused to video to pause. A wired connection of the laptop to the wifi router resulted in smoother streaming video.
Duration Test
A test was conducted to determine how long the system could stream video on a full battery charge. The setup had the PiZero2W streamed content over wifi to a laptop. A script was set up to record the time when the PiZero2W shutdown. On the 4500mAmp/hr battery fully charged the system lasted 11 hours. A similar power test was conducted without the video being streamed and the system lasted 15hours.
This concludes the blog post in support of the review. The next stop is the RoadTest review itself.