JTK – Notes and Ramblings Things we have found …


DDC and CEC and more TV control

Filed under: Home Automation — taing @ 10:54 am

The quest to control the TVs and monitors continues. One promising option is DDC/C control. I was able to install ddcutil: sudo apt-get install ddcutil. For the older Acer units with Nvidia Ion graphics I was able to retrieve EDID but was unable to detect DDC.

The ddcutil website suggested adding the following in /etc/modprobe.d/nvidia-ddc :

options nvidia NVreg_RegistryDwords=RMUseSwI2c=0x01;RMI2cSpeed=100

I found that for the GeForce GT 710 machine this helped but not for the Acer with Ion graphics. Unfortunately, the Samsung T24C550 TV only seems to support a limits subset of DDC commands.

Next up was ddccontrol. After installing, it wasn’t able to detect DDC on the Acer with Ion but was more successful of the GeForce system. Unfortunately, there was no entry for the Samsung in the ddccontrol database so only generic commands appear to be available.

It is worth noting that even on the GeForce system once the monitor went to sleep it wasn’t detected at all by either ddcutil or ddccontrol.

Further notes on using ddcutil without being root can be found at https://frdmtoplay.com/using-ddccontrol-as-a-non-root-user/#:~:text=ddcutil%20is%20a%20CLI%20based,is%20not%20’officially’%20supported. This really comes down to adding users to the i2cusers group.


CEC is another option for controlling HDMI devices. While CEC can be used with a variety of devices it is especially useful on the Raspberry Pi. Again, unfortunately it is not supported by most Nvidia cards but is reported to work with the Nvidia Shield.

Your first step will be to install cec-utils: sudo apt-get install cec-utils. Hopefully a scan will turn up your device.

 echo "scan" | cec-client -s -d 1

If it does not it is worth looking into cec-util from the v4l-utils package. You may find to need to install/create the drivers for /dev/cec0.

For my Samsung, CEC was not enabled by default. Samsung refers to CEC as Anynet+. It can be enabled in the Service Menu. To enter the service menu, with the power to the TV off press MUTE 1 8 2 POWER quickly on the remote. Other Samsung units use INFO MENU MUTE POWER for the service menu.

I found some good info on using Raspberry Pi with CEC and a variety of devices at https://www.raspberrypi.org/forums/viewtopic.php?f=35&t=15593&p=158409&hilit=cec_client#p158409.

An no discussion of using CEC would be complete without mentioning CEC-O-Matic. This website allows you to “build your own” CEC commands.

Samsung – In Depth

There is lots of in depth info on Samsung TVs and firmware at https://wiki.samygo.tv/index.php?title=This_is_the_first_document_you_have_to_read.

Vizio Smartcast

If you have a Vizio with Smartcast there is a bit of detective work shown on github.


Roku Remote Control

Filed under: General,Home Automation,RTL-SDR — taing @ 10:36 pm

Back in April I mentioned adding some Roku remote control. At this point I’m thinking more javascript than Python.

Roku has a good External Control Protocol reference online.

Sending commands

Unfortunately, the Roku API will not accept Cross Origin Request. This is not an issue if communicating from Node or Python but from the browser using xhr or fetch() you will get CORS errors. When sending POST for button presses you don’t care about the response for a “mode:’no-cors’ ” will work.

let resp = await fetch("http://roku-ip:8060/keypress/play", {method:'POST', mode:'no-cors'})

For the GET for status from the browser one option is a “proxy” add the “Access-Control-Allow-Origin” header. Borrowing the idea from https://medium.com/gitignore/building-a-roku-remote-web-app-1c0db0056be4 we set our Apache web server.

sudo pico /etc/apache2/apache2.conf to edit the config file and add the following lines:

<Location /roku>
    ProxyPass "http://roku-ip:8060/"
    ProxyPassReverse "/" 
    Header add "Access-Control-Allow-Origin" "*"

You will need to have several modules loaded in Apache for this to work: headers and proxy_http. This can be done with:

sudo a2enmod proxy_http
sudo a2enmod headers
sudo systemctl restart apache2

Deep Links

A very important link for launching directly into netflix content is https://unogs.com/search/. From this site you can find the contentid for much of the netflix content.

This allows for directly linking to content with something like:

curl -d '' "http://roku-ip:8060/launch/12?contentid=70136120&mediatype=series"

This is a simple POST to the URL with no body.

The folks at unofficial Netflix online Global Search also provide an API.


IR Blaster

Filed under: General,Home Automation,RTL-SDR — taing @ 3:30 pm

We get started with the Sparkfun WRL-15031. The hook-up guide is a good place to start. I am using the  IR Controller ESP8266 firmware.

I don’t have PlatformIO installed so I used the standard Arduino IDE. This was my first time with the ESP8266 so I needed to add the ESP8266 Arduino Core. In the current Arduino IDE this can be done by adding https://arduino.esp8266.com/stable/package_esp8266com_index.json to  the File>Preferences>Additional Boards Manager URLs field of the Arduino IDE. Then using the Board Manager from the Tools > Board menu you can install the esp8266 platform.

Once you have the IDE installed and the board set to Generic ESP8266 you need to make sure you have some libraries installed. ESP8266WebServer, ESP8266WiFi and WiFiManager but you may need to install ArduinoJson, Time and IRremoteESP8266.

It’s time to load the sketch, compile and upload.

The key here is to make sure you set the IO pin definitions correctly.

const int pinr1 = 13; // Receiving pin
const int pins1 = 4; // Transmitting preset 1
const int pins2 = 12; // Transmitting preset 2
const int pins3 = 12; // Transmitting preset 3
const int pins4 = 12; // Transmitting preset 4
const int configpin = 0; // Reset Pin
const int ledpin = 5;

I changed getExternalIP = false; and removed the user_id related and Alex integration code. I set ntpServerName to my internal NTP server. I changed the ntp sync time from 5 minutes to 12 hours near the end of the setup() function: setSyncInterval(43200);.

Once the code is compiled and loaded some testing is needed. On the initial run the ESP will be in AP mode with a SSID of IR Controller Configuration. You can connect and set access point info, hostname, static IP, subnet mask, port, default gateway and passcode.

Once you’re able to connect it is time to find some IR codes. There is a bit of good info in the Tasmota IR page. I found Sony DVD player remotes and some of the IR controlled LED votive candles. There is also good info for Samsung and Vizio TVs online. The codes from http://remotecentral.com often need to be manipulated before they are compatible with the ESP IR library. I created a Excel spreadsheet with worksheets for Vizio, Sony and Samsung.

Once we have the codes we can start controlling things from the web. For example:


will send a power on/off command of 32 bits in SAMSUNG format. After testing a bit of this I created a simple webpage to send a variety of codes.

There is more Arduino IR blaster info at Ken Shirriff’s blogpost 1 and post 2. For more info on Sony codes refer to https://www.sbprojects.net/knowledge/ir/sirc.php and http://www.hifi-remote.com/sony/.

For the record: Toshiba remote: SE-R0047, Vivio Remote unmarked, Sony Remote RMT-B119A, JVC Remote: RM-S212U.


screen at startup

Filed under: General,Home Automation,RTL-SDR — taing @ 11:33 pm

Sometimes it would be nice to have screen start a detached session at start-up. This isn’t complicated. There are two steps. The first is to create a script to be run in the detached session and make it executable. We’ll call it start.sh.

pico start.sh
chmod +x start.sh

The second is to edit /etc/rc.local to have the script run inside screen at start-up. Add the following line before the exit 0 line.

su - pi -c "screen -dm -S pistartup ~/start.sh"

That’s all there is to it. I found notes on this at https://coderwall.com/p/quflrg/run-a-script-on-startup-in-a-detached-screen-on-a-raspberry-pi.


More Flight tracking – adding RadarBox

Filed under: General,RTL-SDR — Tags: , — taing @ 5:55 pm

Radarbox.com is another flight tracking site similar to FlightAware, ADSB-Exchange and FR24. Instructions for feeding to Radarbox can be found at https://www.radarbox.com/sharing-data. Like most of the similar sites, feeding will get you an upgraded account for free. If you are already feeding others it is as simple as downloading and running a bash script.

Once you download and run the script a new repo will be added and their custom feeder app will be installed. Once their feeder starts running you can use sudo rbfeeder --showkey to see what your “key” is. A quick visit to the Radarbox website to create an account then “claim” your system at http://radarbox.com/raspberry-pi/claim and you are good to go.

Powered by WordPress