Video over a simplex 56k UART
Written 2013-01-08
Tags:UART Serial h.264 Video
Some time ago, genpfault and I started building a car. Not just any car. This was a stripped down R/C car from the 90s I got from someone from work. It originally used a 3-step servo(turns all the way left, centers, or turns all the way right), and had two speeds which you toggled through a mechanical transmission. I'll post more about the car later. This project was getting low-latency video from it so we could drive it like a first-person-shooter. On the way there, I ended up with video from my Playstation Eye forwarded over a jumper-wire.
Source Code
The project is currently being kept at github.Test Setup
Currently, I'm using two PL2303 usb to serial adapters, with a jumper wire connecting one adapter's RX line to the other's TX line. Both are configured by stty with the flags 'raw 57600'.Building the code
You'll need SDL_net, SDL2, and opencv headers. As of this writing, SDL2 is in flux, so you'll want to clone the repo, and run `make viewer_stdin encoder`.Getting it running
- Plug in a webcam and run `./encoder | ./viewer_stdin`. This should show a small window of video from the webcam - but now you're using pipes.
- Next, identify the source and destination serial ports. I run minicom on both and see which one can type to the other.
- Now try: `cat /dev/tty[RxSerialPort] | ./viewer_stdin` - nothing should happen...until you also run `./encoder > /dev/tty[TxSerialPort]`