Raspberry Pi support - enables a hard-wired, dedicated dash

Discussion on the RaceCapture App - Windows, Android, OSX and Linux.

Moderators: JeffC, stieg

Post Reply
brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Raspberry Pi support - enables a hard-wired, dedicated dash

Post by brentp »

Hello,

We've added support for Raspberry Pi - check out the announcement here:
https://www.autosportlabs.com/create-a- ... about-100/

Fully documented here: https://wiki.autosportlabs.com/RaceCapt ... spberry_Pi

Let us know if you get this working, would be great to see!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

wizrd54
Posts: 23
Joined: Sat Apr 15, 2017 6:56 pm

Post by wizrd54 »

Anyway to get this to work along with using a USB battery backup so you don't lose power during a pit stop during a race when a kill switch must be used?

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Quite possibly! This is more of a Raspberry Pi topic, so I'd crack the knuckles and warm up the googles - if you find anything good please post it here! :)
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

loftygoals
Posts: 26
Joined: Fri Oct 31, 2014 4:21 am
Location: Dallas, TX

Post by loftygoals »

There are USB battery packs that feature pass through charging. The problem is that most of them only support ~1.2A output while the battery pack is on power (~2.4A when only on battery). I'm continuing to look for a unit that can provide 2-2.5A while charging in passthrough mode.

Assuming I find one, I will use a hardware 12V to micro-USB adapter (can be found on Amazon from seller Spy-Tech, 5V 3A). This will plug into the battery pack. Then the batter pack will plug into the RPi. Then then of course the USB from the RPi will plug into the RCP. Because the RCP is plugged into the RPi, the RCP will stay powered from the RPi even when 12V is removed from the RCP.

-bj

jaytee
Posts: 26
Joined: Mon Jul 10, 2017 1:25 am
Location: Atlanta, GA

Post by jaytee »

This could be a clean solution, though I'm not sure when or if they'll be able to deliver:

https://www.pi-supply.com/product/pijuice-standard/

thokes82
Posts: 8
Joined: Wed Aug 02, 2017 4:01 pm
Location: Aachen, Germany
Contact:

Post by thokes82 »

ok, here my write up:

I got my raspberry Pi3B a couple of days ago along with the official 7" display and the case for both. Looks useful but when I install it in the car I was wondering why the screen is flipped upside down. Now that I read a bit, they do it intentionally to increase the viewing angle. So you have to mount the case upside down. This is ok and works as good.
I installed the standard rasbian OS with the Noobs installer. It is not just called this way: "noobs", it is really for people like me who never worked with any Pi.

Then I had to change some configurations. The first and most important one is the screensaver. I found 100 tutorials about how to turn it off, no success. Then I found the noob-way:
Type thin into your Terminal:

Code: Select all

sudo apt-get install xscreensaver
Then you get a nice config tool installed where you can turn all energy saving/screensaver stuff off.

The next thing was to enable a push-button for left/right key to flip the pages in the app. I did not want to hack a keyboard etc, I just wanted to use the GPIO on the Pi. So I needed a Deamon which runs in the background to emulate a keyboard. No problem if you know how to:

pikeyd is a c program which translates the GPIO HI/LOW to keyboard presses.

Code: Select all

sudo git clone https://github.com/mmoller2k/pikeyd.git
cd pikeyd
sudo nano joy_RPi.c
If you use a Pi3, you must change one #define before you continue. The line is called
#define GPIO_PERI_BASE 0x20000000
change the number into 0x3f000000
After saving the file, go on with:

Code: Select all

sudo make 
sudo modprobe uinput 
sudo cp pikeyd /usr/local/bin/pikeyd
pikeyd needs a config file to map the key presses to GPIO pins

Code: Select all

sudo nano /etc/pikeyd.conf
and paste the following code and save

Code: Select all

# {all keycodes can be found in /usr/include/linux/input.h} {GPIO pin no}
# The numbers are the GPIO numbers. It is not the Pin on the header!! This drove me nuts!

KEY_LEFT 2 #Pin03 on Header
KEY_RIGHT 4 #Pin07 on Header

KEY_ESC 14 #not used in my setup. 
Now, lets make sure pikeyd start when we boot up

Code: Select all

sudo nano /etc/rc.local
Add the following line before exit 0

Code: Select all

/usr/local/bin/pikeyd -d
Save the file.
Now we want to launch the uinput module every time we boot up automatically:

Code: Select all

sudo nano /etc/modules
Scroll to the bottom of the file and add:

Code: Select all

uinput
Save the file.

The thing is, that every button requires a pull-up resistor on the Pi GPIO unless you switch on the internal pull-ups. I have done that and I will explain you how in the following description.
I wanted to run the Pi with an external power pack. To be able to turn it on and off, I needed to add a button on the GPIO which runs a script. The best one I found was this here.

Code: Select all

sudo git clone https://github.com/gilyes/pi-shutdown.git
nano pi-shutdown/pishutdown.py
Here I wanted to come back on the pull-up resistors. Now, in the file add below the line "shutdownPin =5"

Code: Select all

leftPin = 3 #GPIO2
rightPin = 7 #GPIO4
escPin = 8 #GPIO14
then go down in the file and find the line "GPIO.setup(shutdownPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)"
add below:

Code: Select all

GPIO.setup(shutdownPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) #already existing
GPIO.setup(leftPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(rightPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(escPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
save the file and copy it to the opt location.

Code: Select all

sudo cp pi-shutdown/pishutdown.py /opt/pishutdown.py
Now we want to run the script as a service in the background. To do this create a file called pishutdown.service in /etc/systemd/system/:

Code: Select all

sudo nano /etc/systemd/system/pishutdown.service
fill the file with:

Code: Select all

[Service]
ExecStart=/usr/bin/python /opt/pishutdown.py
WorkingDirectory=/opt/
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=pishutdown
User=root
Group=root

[Install]
WantedBy=multi-user.target
Enable service:

Code: Select all

sudo systemctl enable pishutdown.service
Run service (will be automatically started on next reboot):

Code: Select all

sudo systemctl start pishutdown.service
I got an error message here but after the restart the script was running. You can now reboot by connecting pin 5 to ground for less than 3 seconds. if you push for longer than three seconds, the Pi will turn off. If you stay with pin 5 you can wake up th Pi by pressing the button again after shutdown. This will work on this pin only.

grounding Pin 3 will be as if you press keyboard left, Pin 7 is for keyboard right. This will be on my steering wheel to change pages. ESC is mapped to Pin 8 but I think I will not use it.

This is it for now.

DanielsDM
Posts: 10
Joined: Mon Feb 22, 2016 4:43 pm

Post by DanielsDM »

This looked really cool and just what I need.
I got the raspberrypi and display and 12v-5v 3A powersupply.
Went through the installation instructions. Kind of convoluted since it is follow this link, do that, then follow this link etc... Felt more like a scavenger hunt. :? But all in all it went ok until....
Apparently the multi touch tools didn't load correctly (didn't have anyway to test it since I was still waiting for the 3A power supply to arrive and the car adapter I was using wouldn't run both the Pi and the display simulataneously). Then I loaded the the app and edited the boot file to launch the RC app automatically.
The app comes up automatically on startup, great! But the touch screen doesn't work so I can't do anything with it or even exit the app to try and reload the multi touch tools. Is there a keyboard command that will close the app? Or one that will prevent the app from loading at boot? Looks like a jumped the gun when I edited the boot file and now I'm stuck. Any help would appreciated... Brent????

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Yes, indeed - that's why we emphasized the experimental nature and some advanced skill needed. It's definitely not plug and play!

Regarding the touch screen, you might want to double check the RPi documentation and use those tools and guides to verify the touch screen works as expected - you could try loading up the RPi full disk image on a secondary SD card and launch the windowing system to verify touch works, as well.

Let us know what you find out!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

DanielsDM
Posts: 10
Joined: Mon Feb 22, 2016 4:43 pm

Post by DanielsDM »

As you suggested I loaded the full RPi image (with Noobs) on a second SD card. The touchscreen works as intended. So I know the hardware if functioning.
Then switched back to the other SD card (with Jessie Lite), boot up and start racecapture. No response from the touchscreen.
So then I started over. Wiped the SD card and went through the entire process again. Again no response from the touchscreen. It also does not respond the arrow keys or a mouse. Esc will take it to the home screen. No other keys seem to do anything.

DanielsDM
Posts: 10
Joined: Mon Feb 22, 2016 4:43 pm

Post by DanielsDM »

wizrd54 wrote:Anyway to get this to work along with using a USB battery backup so you don't lose power during a pit stop during a race when a kill switch must be used?
I plan on supplying power from a circuit that stays live when the ignition is off. It will only power off when the emergency kill switch is turned off and all power to the car is cut.

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Not sure why that's happening. Anyone else seeing the same problem?

We released two RPi app images so far; you might want to try the original image on a fresh OS build and see if that changes anything.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

PS14
Posts: 97
Joined: Fri Feb 12, 2016 11:27 pm
Location: NY

Post by PS14 »

thokes82, can you answer something for me. does the pi3 GUI use a different conf file when running the racecapture app? I am using a Pi3 w/10.1 resitive touch waveshare screen (GPIO). touchscreen works fine with GUI (PIXEL LITE). but when I launch RC app, the touchscreen inputs appear swapped and inverted.

editing the /etc/usr/X11/xorg.conf.d/99-calibration.conf only seems to effect the GUI.

great write up on the GPIO inputs, if I can get this screen to work I plan on using them. Dave

PS14
Posts: 97
Joined: Fri Feb 12, 2016 11:27 pm
Location: NY

Post by PS14 »

Brent, still trying to get my 10.1" Waveshare LCD working correctly with PI3 and the RC app. I spoke with the vendor and this was their reply:

"The .sh file is most likely a shell script. Those are typically used to setup environment variables and related settings before running the actual software (which seems to be "racecapture", located in the root of the archive).

It is very possible that the libraries used by the software to produce a GUI do not support the touch screen properly or skip it as an input device. The best would be to contact the company that makes this software for support.

As you already confirmed, the touch component of your touchscreen is working well with the RPi GUI, so this assures us it is working well at this moment."


I realize this isn't your problem, but if you could give me some input/direction I would appreciate it. I like this unit as i't's compact in form, large screen and resistive touch. thanks, Dave

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi,

It's entirely probable you'll be able to get this touchscreen to work, with some effort.

The app is based on the Kivy framework. The key here is configuring the settings for touch / mouse. See near the bottom of the Kivy project's raspberry Pi how-to:
https://kivy.org/docs/installation/inst ... n-rpi.html

It will be a matter of finding the right settings for your screen.

Take a look at the startup script we provide in the raspberry pi package; you'll see how we work to detect the correct screen and apply the correct config file. We support the official display and another touch screen controller that we're experimenting with.

Let us know what you find out!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

DanielsDM
Posts: 10
Joined: Mon Feb 22, 2016 4:43 pm

Post by DanielsDM »

brentp wrote:Not sure why that's happening. Anyone else seeing the same problem?

We released two RPi app images so far; you might want to try the original image on a fresh OS build and see if that changes anything.
Success!! Loading the archived version of Racecapture (1.10.2) on a fresh OS build (Jessie Lite) worked.

Post Reply