Raspberry Pi based Instant Replay system

Other race electronics and general electronics discussions.
Post Reply
ironband
Journeyman
Journeyman
Posts: 47
Joined: Mon Jan 30, 2017 9:58 am
Location: Livermore, CA

Raspberry Pi based Instant Replay system

Post by ironband »

Hi all,

As some of you know, I've been working on retrofitting my Microwizard P2XL with an Arduino timer for serial communication as well as timing. As an adjunct to that project, I picked up an old Raspberry Pi B+ as well as a V2 PiCamera, and thought it would be cool to interface them with the Arduino timer to add an instant replay to the system:


https://youtu.be/-QyMxKfBaAE

The cool thing about this system is that it doesn't rely on another sensor to trigger the replay - it simply gets a signal from the arduino timer when the first car finishes, then pulls video from a continuous loop (about 7 seconds) to make sure that it gets the first car finishing as well as any finishes which occur up to a second later or so. It then takes the 90fps video and pulls it down to about 20fps to give a slow motion replay.

In the video, I don't have the PC hooked up to get the serial communication, demonstrating how this system could be used stand-alone with any arduino based timer by adding a couple lines of code and a couple of resistors (for a voltage splitter) to the shield board.

I've got a little work to do, as the camera isn't well focused at this distance, and I'm not sure it is the angle I really want. Additionally I think I'll have the replay play two or three times total. At some point if I feel ambitious, I may do some basic serial communication to overlay text with finish times on the monitor, but that's a task for after I get all the electronics in a box.

So, for those of you who do use instant replay, what do you find is the most effective camera angle?
User avatar
gpraceman
Site Admin
Site Admin
Posts: 4926
Joined: Fri Jun 20, 2003 12:46 am
Location: Highlands Ranch, CO
Contact:

Re: Raspberry Pi based Instant Replay system

Post by gpraceman »

I like the view from the end of the track, looking up towards the start line. I like to see the whole drama of the race, not just the finish, as some cars get a fast start but then get passed in the flat.
Randy Lisano
Romans 5:8

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.
ironband
Journeyman
Journeyman
Posts: 47
Joined: Mon Jan 30, 2017 9:58 am
Location: Livermore, CA

Re: Raspberry Pi based Instant Replay system

Post by ironband »

gpraceman wrote:I like the view from the end of the track, looking up towards the start line. I like to see the whole drama of the race, not just the finish, as some cars get a fast start but then get passed in the flat.
I like the idea of that, but it makes it hard to see the finish clearly if you aren't a little above the finish line, which of course makes it hard to see the whole track (especially where the gate is in the way).

But I also agree that the drama of the race is fun to see as well! So, now I'm thinking two cameras, one placed on top of the finish gate facing the starting gate to show the "drama" at full speed, and another elevated above the finish line to show the "exciting conclusion" in slow motion. Not sure if I'll get both of them automated or not, but it's worth a try!

Andre
BenInSD
Apprentice
Apprentice
Posts: 3
Joined: Fri Mar 24, 2017 11:33 am
Location: San Diego, CA

Re: Raspberry Pi based Instant Replay system

Post by BenInSD »

sweet...I'm looking to setup something similar...can you share your code for this?
ironband
Journeyman
Journeyman
Posts: 47
Joined: Mon Jan 30, 2017 9:58 am
Location: Livermore, CA

Re: Raspberry Pi based Instant Replay system

Post by ironband »

Hi Ben in SD,

Certainly - my code is in the description of this youtube demo:


https://youtu.be/-QyMxKfBaAE

Here is some video of it in action on an actual track:


https://youtu.be/B3lcQHWGq88

Note to get clear video you do have to focus the camera for this distance and make sure the finish line is well lit. Indoors we had a lot of speed blur.

Regards,

Andre
User avatar
gpraceman
Site Admin
Site Admin
Posts: 4926
Joined: Fri Jun 20, 2003 12:46 am
Location: Highlands Ranch, CO
Contact:

Re: Raspberry Pi based Instant Replay system

Post by gpraceman »

Could you use a USB webcam with this instead of the PiCamera? With 4 USB ports on the RPi, maybe supporting multiple camera angles would not be too hard to integrate.

Have you thought about an external trigger sensor? Not everyone will want to tap into their timer's electronics, especially if it is commercial unit.
Randy Lisano
Romans 5:8

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.
ironband
Journeyman
Journeyman
Posts: 47
Joined: Mon Jan 30, 2017 9:58 am
Location: Livermore, CA

Re: Raspberry Pi based Instant Replay system

Post by ironband »

I tried it with a USB camera, but the response was too slow. Granted, that was when I was running a Raspberry Pi B+. Now that I'm running a 3, it might be worth another try.

That said, I am playing with the idea of networking a Pi Zero in to get another camera angle. I have all the hardware, I just need time to play with it.
ironband
Journeyman
Journeyman
Posts: 47
Joined: Mon Jan 30, 2017 9:58 am
Location: Livermore, CA

Re: Raspberry Pi based Instant Replay system

Post by ironband »

With regard to the external sensor, I have toyed with it. What I have going now as a prototype that I need to test is a box that goes between the gate and the computer. When the box senses that finish line data has been sent to the computer, it triggers my code, using the longest finish time to go back to the proper moment and show the replay. It works when I use a computer to emulate the finish line, but I need to test it with a real finish line to get it ready for prime time.
User avatar
gpraceman
Site Admin
Site Admin
Posts: 4926
Joined: Fri Jun 20, 2003 12:46 am
Location: Highlands Ranch, CO
Contact:

Re: Raspberry Pi based Instant Replay system

Post by gpraceman »

ironband wrote: Wed Sep 04, 2019 11:01 pm What I have going now as a prototype that I need to test is a box that goes between the gate and the computer. When the box senses that finish line data has been sent to the computer, it triggers my code, using the longest finish time to go back to the proper moment and show the replay. It works when I use a computer to emulate the finish line, but I need to test it with a real finish line to get it ready for prime time.
That was the other option that I thought about. That can get a bit complicated for different timers. Most timers send all the results all at once after all cars have finished. That poses a problem when a car doesn't finish, of course. A couple of timers (The Judge and Racemaster) send results as each lane finishes.
ironband wrote: Wed Sep 04, 2019 10:59 pm That said, I am playing with the idea of networking a Pi Zero in to get another camera angle. I have all the hardware, I just need time to play with it.
Makes sense, as USB cable length is limited, without using a booster.

Good luck with it all.
Randy Lisano
Romans 5:8

Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.
Post Reply