PeterSpie
Posts: 1
Joined: Fri Jan 24, 2020 8:32 am

Is this possible to do with RaspberryPi - serial control of TV

Fri Jan 24, 2020 8:58 am

Hello,

as an absolute beginner to Raspberry Pi I have a few questions before I start my project.
So I don't waste a lot of time and then find out it is not possible.

I have a big televison screen at our rowing club, with multiple HDMI ports and a serial port. I also have the documentation for this serial port which shows that via serial commands it should be possible to change standby to on and off, and change input from HDMI1 to HDMI2.

1) I want to use Rapsberry Pi to change the input wich should be done via two pushbuttons, one for HDMI1 and an other for HDMI2.
2) I also would like to switch standby to "On" and "Off" via this serial connector. Changing the standby status should be done in three different ways:
2a) via a timer on the raspberry Pi, so for example switch on every work day at 09.00 and swith off every work day at 17:00 hrs.
2b) via a motion sensor, when someone enters the room, and the screen is not switched on, switch on, and (for example) switch off after 15 minutes of no movement.
2c) triggerd by the light in the hall, so 220 volt -> 5 volt and then input this on the rapsberry Pi.

Hopefully this can be done, and I can start this (big) project.

Regards, Peter

User avatar
DougieLawson
Posts: 37090
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Is this possible to do with RaspberryPi

Fri Jan 24, 2020 10:22 am

Search the internet for "raspberry CEC HDMI".

There's a whole bunch of stuff a RPi can do with a CEC compatible HDMI TV.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
davidcoton
Posts: 4537
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Is this possible to do with RaspberryPi

Fri Jan 24, 2020 10:30 am

PeterSpie wrote:
Fri Jan 24, 2020 8:58 am
2c) triggerd by the light in the hall, so 220 volt -> 5 volt and then input this on the rapsberry Pi.
First, do not apply 5V to your Pi's GPIO. It will potentially kill it. The GPIO needs 3V3.

Second, but possibly more important, make sure that any mains work you do is safe -- in the UK it should conform to BS7671 IET Wiring Regulations 18th Edition -- if your mains is 220V I guess that is not UK so you need to understand the local regulations. You may need to get a qualified electrician to do (or at least supervise) any fixed mains connections. Remember there are potentially serious consequences of mistakes - to your Pi, your clubhouse (fire), and to the lives of your club members and guests.
Signature retired

User avatar
neilgl
Posts: 1396
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Is this possible to do with RaspberryPi - serial control of TV

Fri Jan 24, 2020 10:50 am

+1 For 2c do not connect anything to the mains 220v, just use a photodiode or phototransistor to detect the light on/off. Much safer and easier.

fanoush
Posts: 504
Joined: Mon Feb 27, 2012 2:37 pm

Re: Is this possible to do with RaspberryPi - serial control of TV

Fri Jan 24, 2020 12:21 pm

Looks like it can be done in two different ways
PeterSpie wrote:
Fri Jan 24, 2020 8:58 am
, with multiple HDMI ports and a serial port. I also have the documentation for this serial port which shows that via serial commands it should be possible to change standby to on and off, and change input from HDMI1 to HDMI2.
If the serial port on TV is typical RS-232 9 pin like described here https://pinouts.ru/SerialPorts/Serial9_pinout.shtml you need USB to RS-232 serial adapter, it is $2 ebay item (random selection). Do not buy USB to TTL adapters (not ending with 9pin RS232 connector) as you already have such TTL serial port on the Pi but it wont work without ttl to rs232 adapter. So if you don't want to use USB port then such ttl to rs232 adapter alone would work too (like this one) when conencted to GPIO pins 8,10

Another solution is to use CEC feature of HDMI as others suggest, then you don't need serial. However if you already have documentation for the serial port I'd go with the serial way as there are probably more possibilities what can be done.

User avatar
davidcoton
Posts: 4537
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Is this possible to do with RaspberryPi - serial control of TV

Fri Jan 24, 2020 1:50 pm

fanoush wrote:
Fri Jan 24, 2020 12:21 pm
So if you don't want to use USB port then such ttl to rs232 adapter alone would work too (like this one) when conencted to GPIO pins 8,10
If you go this route, it is ESSENTIAL to use an adapter based on MAX3232, or equivalent with 3V3 connection to the Pi. The alternative MAX232 uses 5V signalling to the Pi, which is a Bad Thing. The Ebay item linked could be either -- both types are mentioned in the title but there is no specification. Make sure you know which you are buying.
Signature retired

fanoush
Posts: 504
Joined: Mon Feb 27, 2012 2:37 pm

Re: Is this possible to do with RaspberryPi - serial control of TV

Fri Jan 24, 2020 4:11 pm

davidcoton wrote:
Fri Jan 24, 2020 1:50 pm
If you go this route, it is ESSENTIAL to use an adapter based on MAX3232, or equivalent with 3V3 connection to the Pi.
Good point about 5V vs 3.3V. The adapter looks like it has only 4 pins - GND,VCC,RX,TX so hopefully you can put 3.3V from Pi to VCC and TX/RX levels will then match. Here is another one with photo of the chip with MAX3232 label. As per datasheet it works in 3-5.5V range.

User avatar
davidcoton
Posts: 4537
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Is this possible to do with RaspberryPi - serial control of TV

Fri Jan 24, 2020 6:05 pm

fanoush wrote:
Fri Jan 24, 2020 4:11 pm
davidcoton wrote:
Fri Jan 24, 2020 1:50 pm
If you go this route, it is ESSENTIAL to use an adapter based on MAX3232, or equivalent with 3V3 connection to the Pi.
Good point about 5V vs 3.3V. The adapter looks like it has only 4 pins - GND,VCC,RX,TX so hopefully you can put 3.3V from Pi to VCC and TX/RX levels will then match. Here is another one with photo of the chip with MAX3232 label. As per datasheet it works in 3-5.5V range.
MAX232 is not specified for 3V3 operation. That is why it is important to get the MAX3232 which is.
Signature retired

hippy
Posts: 6735
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Is this possible to do with RaspberryPi - serial control of TV

Fri Jan 24, 2020 7:32 pm

fanoush wrote:
Fri Jan 24, 2020 12:21 pm
So if you don't want to use USB port ...
I would say "just buy a USB to RS232 (9-way D) serial cable and be done with it".

Much simpler, easier, should be just as cheap, will be 'plug and play' with no worrying over voltages or compatibility.

Return to “Beginners”