Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Raspberry cam as reverse cam?
#11
I've run a wire from the reverse lights to a 12v to 3v which will then hit a GPIO pin.

Not tested it works yet, but can't see why it wouldn't



You just need a script like the below (credit Hisma) to monitor the GPIO pin and turn on the software to display the video.

https://pastebin.com/RfUPw0AZ
Reply
#12
Can anyone offer suggestions as to why I can't get that script of Hisma's to work?

Everything seems to be wired up correctly but I still get no response from manually running the python script in terminal.

The relay switches correctly when I go into reverse. The python script is in /home/pi/Apps/    I have run chmod +x on the script.

raspivid -t works well, but no life from the script. If I add print into the python script to see where it gets up to it "stops" at line 14 which is run=0

I have the official raspberry pi camera.

Any help would be appreciated!
Reply
#13
have you installed the required gpio python from apt-get?
Reply
#14
I did this:

sudo apt-get update
sudo apt-get install rpi.gpio

It said it updated, but the script still didn't work for me.

Thanks for helping as I am tearing my hair out on this one. At the moment I have a button in OA Applications that switches on raspivid for 15 seconds (as mentioned elsewhere on this forum) but can't see why it doesn't work automatically!
Reply
#15
I have the same issue.. it was working earlier, but done a few reflashes.
I'm testing electrical on the GPIO this coming weekend...
I also recall making changes to the up vs down and changing a logic test, but that was because reverse cam popped up while in every gear but reverse!
Reply
#16
(07-26-2019, 01:00 AM)rcg Wrote: Can anyone offer suggestions as to why I can't get that script of Hisma's to work?

Everything seems to be wired up correctly but I still get no response from manually running the python script in terminal.

The relay switches correctly when I go into reverse. The python script is in /home/pi/Apps/    I have run chmod +x on the script.

raspivid -t works well, but no life from the script. If I add print into the python script to see where it gets up to it "stops" at line 14 which is run=0

I have the official raspberry pi camera.

Any help would be appreciated!

Hey did you enable the camera option in the raspberry pi configuration inside of raspbian?  I am pretty sure I mention that in my video.  The cam will not work without that, even if you have a working script.  

I am not sure what has changed (if anything) since I set up the cam.  It was working fine up until the last day I used it (mid June) but unfortunately I am out of the country for the next year+ & won't have access to my car!  Sad

Also, if it's making it to "run = 0" & failing, try declaring "run = 0" at the beginning of the script to see if that helps. Can't possibly see why that would be necessary, but I can't think of any other reason why it would make it to that line & fail.
Reply
#17
Thanks Hisma. Great videos by the way, they inspired me to give all of this a go.

I actually got it working tonight!

Mentalinc mentioned "up vs down" in his last post above and that got me thinking. I changed on line 10:

GPIO.setup(RearView_Switch,GPIO.IN, pull_up_down=GPIO.PUD_UP)

to

GPIO.setup(RearView_Switch,GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

and that made all the difference for me. In addition to that I was having trouble launching scripts from rc.local until I read somewhere that everything should have an & after fi  and before exit. Blindly following this advice I ensured that this was the case and presto, the thing is autostarting at boot and running perfectly.

I can finally move on!!! Thanks for all the help mentalinc and Hisma.
Reply
#18
Ahh okay. I think the pull-up vs pull-down depends on how you have your GPIO terminated. Glad you got it working!

Thanks for for the kind words. My hope was to inspire others to take on a project like this & help the community grow. The more people that build these things the more we all benefit.
Reply
#19
Hi Guys,

I was hoping you guys could help me, I am very new to raspberry pi, still finding my feet. I have OAP installed on my pi, after some trial and error, I have it working to a point i'm happy with.
I have played a little bit with Ardunio, done a little of VB programming but i'm a little lost with the pi programming structure. I have a 5mp pi camera attached to my system which I want to use as a reversing cam, is it possible to point me in the right direction on how to setup the camera using GPIO fron start to finish including what scripts I need and where to put them?

Thanks in advance.
Cheers,
Baz.
Reply
#20
@Robazz did you read this thread before posting? The solution is already there.
We are also preparing next beta OAP with support for reverse camera.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)