Sitebase / campervan

Code and documentation for my complete campervan build
1 stars 0 forks source link

Select HDMI to use as display for a command #1

Open Sitebase opened 4 years ago

Sitebase commented 4 years ago

If we can have a way to for example choose which HDMI is used to output the result of a certain command we could use our Raspberry for the navigation as the main computer for all the screens in the van.

For example this way we could run a command to run Kodi (media center) on the main screen in the back which we then can use to view some Netflix.

Aplay command

aplay -l lists HDMI devices

Tvservice

tvservice -l lists HDMI devices

Sitebase commented 4 years ago

Auto select HDMI or DSI at boot time. https://github.com/procount/pinn/blob/master/README_PINN.md#how-to-auto-switch-hdmidsi-screen-configurations

Sitebase commented 4 years ago

Adding ignore_lcd=1 to your config.txt will show crankshaft UI on TV if you plug in the HDMI. Problem is that it will not fall back to the 7" display if you remove the HDMI cable and reboot.

Sitebase commented 4 years ago

display_default_lcd

If a Raspberry Pi DSI LCD is detected it will be used as the default display and will show the framebuffer. Setting display_default_lcd=0 will ensure the LCD is not the default display, which usually implies the HDMI output will be the default. The LCD can still be used by choosing its display number from supported applications, for example, omxplayer.

https://www.raspberrypi.org/documentation/configuration/config-txt/video.md

This sounds like the option we are looking for. If we combine this with some sort of HDMI relay cut in the main TV cable we can trigger the relay to enable the HDMI and then trigger a reboot command using SSH 😅. Not sure if this will work but will test it out. Biggest question is that if you cut a HDMI cable in two en plug it in your Raspberry Pi if it's get detected as an output. I would guess that will not be the case.

Sitebase commented 4 years ago

Find EDID for connected HDMI devices: tvservice --name

Using the EDID add the following to your /boot/config.txt

[EDID=SAM-SAMSUNG]
ignore_lcd=1
hdmi_group=2
hdmi_mode=82
[all]

It will ignore the 7" touchscreen if a HDMI display is connected and if no display connected it will fall back to the 7" touchscreen.

Use these HDMI breakouts with a circuit to connect or cut all the HDMI wires.

Sitebase commented 4 years ago

I though that maybe removing the power from the TV screen will solve the problem but it seems that the HDMI transmitter (Raspberry PI) is sending of 5v to the screen to be able to read the EDID of the screen. This way it still detects the screen and will still try to used it on boot.

I've tested this by disconnecting the HDMI connector from the screen and then rebooting the Pi. At that moment the Pi used the 7" inch display again.

It will probably be enough the just make an HDMI connector that cuts the 5v line while the TV should not be used.

So there should be a switch in the van to turn on the power for the screen and it should also trigger a relay (bistable relay ideally) to pass through the 5v pin of the HDMI.

Sitebase commented 4 years ago

Found a better solution. In the Raspberry Pi config.txt you can also configure filters based on the state of GPIO pin.

Using following config in /boot/config.txt:

# Determine to use the 7" display as monitor or the HDMI port
[gpio6=1]
ignore_lcd=1
[all]

in combination with this little circuit:

Screenshot 2020-06-02 at 17 19 36

And to top it off we add some script to crankshaft/startup.py that listens on GPIO6 and triggers a reboot.