karlherrick.com

Racing with the Pi

Wednesday, 27 February 2019

Car ready to race

The Raspberry Pi continues to deliver on cool projects to spend time with the family on. As a non-serious entrant for this year’s wood car race, we used a Pi Zero, Pi Camera Module, USB Wi-Fi adapter, and UPS PIco to send it down the track while streaming the video.

We were able to build simply and get it under “regulation weight” by limiting the amount of hardware attached, and fastening everything with thumb tacks and hot glue. There’s a lot of functionality on the UPS PIco that could be used to make the process easier, like accessible pins, push buttons, LEDs, and a tiny speaker—but I opted to SSH into the car and run the following script manually to start the video stream:

#!/usr/bin/env bash
  printf 'connect to http://0.0.0.0:8080/\n'

  raspivid -o - -t 0 -hf -w 640 -h 480 -fps 24 | \
    cvlc -vvv stream:///dev/stdin \
      --sout '#standard{access=http,mux=ts,dst=:8080}' :demux=h264
Preview to race video

It was saved using a Mac, running VLC on the same wireless network:

#!/usr/bin/env bash
  readonly HOSTNAME=piracecar
  declare TIMESTAMP

  TIMESTAMP=$(date +'%Y-%m-%d_%H-%m-%S')

  /Applications/VLC.app/Contents/MacOS/VLC \
    -I rc http://${HOSTNAME}:8080 \
    --sout="#std{access=file,mux=mp4,dst=${TIMESTAMP}.mp4}"


Home

About

Portfolio

Web Apps Web Enabled Applications Corporate Sites Personal Sites
Preferences Dark Theme Light Theme Notifications
Social GitHub LinkedIn RSS Feed Icon