I wanted to control the input of my monitors, these are my findings.
DDC – Display Data Channel I2C – (Inter-Integrated Circuit, eye-squared-C), alternatively known as IIC, is a synchronous, multi-master/multi-slave (controller/target) bus
Getting monitor information with the ddccontrol -p command
##### PART OF THE OUTPUT #####
Detected monitors :
- Device: dev:/dev/i2c-9
DDC/CI supported: Yes
Monitor Name: VESA standard monitor
Input type: Digital
(Automatically selected)
- Device: dev:/dev/i2c-7
DDC/CI supported: Yes
Monitor Name: VESA standard monitor
Input type: Digital
- Device: dev:/dev/i2c-6
DDC/CI supported: Yes
Monitor Name: VESA standard monitor
Input type: Digital
Reading EDID and initializing DDC/CI at bus dev:/dev/i2c-9...
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/AOC2490.xml"
Switching inputs
ddcutil -b 7 setvcp 0x60 0x11 # 7 is Second monitor (starts with 6), 0x60 is the input register (see below) and 0x11 is HDMI
ddcutil -b 6 setvcp 0x60 0x0f # First monitor DP (Displaylink)
alternative command
ddccontrol -r 0x60 -w 15 dev:/dev/i2c-7
List the control registers
ddccontrol -d dev:/dev/i2c-6
ddccontrol version 0.6.0
Copyright 2004-2005 Oleg I. Vdovikin (oleg@cs.msu.su)
Copyright 2004-2006 Nicolas Boichat (nicolas@boichat.ch)
This program comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of this program under the terms of the GNU General Public License.
Reading EDID and initializing DDC/CI at bus dev:/dev/i2c-6...
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/AOC2490.xml"
Document not parsed successfully.
EDID readings:
Plug and Play ID: AOC2490 [VESA standard monitor]
Input type: Analog
=============================== WARNING ===============================
There is no support for your monitor in the database, but ddccontrol is
using a basic generic profile. Many controls will not be supported, and
some controls may not work as expected.
Please update ddccontrol-db, or, if you are already using the latest
version, please send the output of the following command to
ddccontrol-users@lists.sourceforge.net:
LANG= LC_ALL= ddccontrol -p -c -d
Thank you.
=============================== WARNING ===============================
Controls (valid/current/max) [Description - Value name]:
Control 0x02: +/1/2 C [New Control Value - No changes]
Control 0x04: +/0/1 C [Restore Factory Defaults]
Control 0x05: +/0/1 C [Restore Brightness and Contrast]
Control 0x08: +/0/1 C [Restore Factory Default Color]
Control 0x10: +/90/100 C [Brightness]
Control 0x12: +/50/100 C [Contrast]
Control 0x14: +/5/13 C [???]
Control 0x16: +/50/100 C [Red maximum level]
Control 0x18: +/50/100 C [Green maximum level]
Control 0x1a: +/50/100 C [Blue maximum level]
Control 0x60: +/772/4 C [Input Source Select (Main)]
Control 0x62: +/17/100 C [Audio Speaker Volume Adjust]
Control 0x6c: +/50/100 C [Red minimum level]
Control 0x6e: +/50/100 C [Green minimum level]
Control 0x70: +/50/100 C [Blue minimum level]
Control 0xac: +/6750/65535 [???]
Control 0xae: +/6000/65535 [???]
Control 0xb2: +/1/8 [???]
Control 0xb6: +/3/8 C [???]
Control 0xc8: +/5/65302 C [???]
Control 0xc9: +/8/65535 C [???]
Control 0xcc: +/4/255 [???]
Control 0xd6: +/1/4 C [DPMS Control - On]
Control 0xdf: +/513/65535 C [???]
Control 0xfe: +/4/255 [???]
Setting volume (reg 0x62) of monitor 2
ddcutil -b 7 setvcp 0x62 0x01
AOC monitorPROBLEM
You can’t switch from an input which is not active! So my workstation is connected via DP, and i can switch to HDMI. Now i HAVE TO use the hdmi to switch back to DP. A solution could be to ssh into the machine connected with HDMI (passwordless login) and switch back to DP. I made a mqtt button sending a topic that was read by the two machines using the mqtt python program elsewhere on this site. (Rotary Mqtt Volume control)
I’ve modded several LSC devices, most of them i could flash with esp-easy or tasmota. Why mod it? Because it uses the cloud .. i’d like to keep control myself. Just connect/solder a USB to TTL Converter UART Module like below. (See other posts)
But this alarm was different, i ended up removing the chip and replace it with a ESP12.
Warning .. loud! .. Yes almost xmasA WR3 is almost like a ESP-12
So now i had to figure out which GPIO pins and how to control them.
#1/bin/bash
# Flashed ESP Easy on this one
# When i did this, 2019, you needed version 2.1-beta1
# GPIO 4 controls LED
sleep 10
curl http://10.1.1.251/control?cmd=GPIO,4,1
sleep 1
curl http://10.1.1.251/control?cmd=GPIO,4,0
sleep 1
curl http://10.1.1.251/control?cmd=GPIO,4,1
sleep 2
curl http://10.1.1.251/control?cmd=GPIO,4,0
sleep 5
# Sending rtttl ringtone
curl "http://10.1.1.251/control?cmd=rtttl,5:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6"
alarm sound
curl "http://10.1.1.251/control?cmd=rtttl,5:d=4,o=5,b=160:2g,2c6,2g,2c6,2g,2c6,2g,2c6"
pager
curl "http://10.1.1.251/control?cmd=rtttl,5:d=4,o=5,b=160:8d6,16p,2d6,16p,8d6,16p,2d6,16p,8d6,16p,2d6"
Update 20221208 – removed internals
Removed my old hack and replaced it with a Wemos D1. Added a LED Next to do .. add a amplifier using a LM356/358
I want to know whats on my network, and be informed when a alien device connects. This also helps me gathering all devices and macaddresses for a cmdb.
I’ve got below in my crontab
5 * * * * root /usr/local/bin/arpscanner
And the script:
#!/bin/bash
# Using a scanner on a specific vlan/interface
arp-scan -l -g -I p1p1.10 | grep ^10 | grep -vi packets > /var/log/arpscanner
cat /var/log/arpscanner | awk '{ print $2 }'| while read ; do
grep $REPLY /var/local/arpscanner.lst >/dev/null || echo $REPLY | mail -s arpscanner henri@henriaanstoot.nl
done
New and checked devices i put in the file mentioned above: /var/local/arpscanner.lst
For measuring pressure in fermentation containers, I designed a pressure sensor which could be wireless connected to a fermentation container. The sensor would transmit the values to a Raspberry which was configured as a Access Point and would store the measurements and generated graphs using Grafana.
Connect esp with a power source. Look for a AP with ESP_Easy_0
Use password “configesp” to connect
Start you browser and enter http://192.168.4.1
In wifi wizard setup select “pressurespot” Enter password “pressurespot”
Press connect
Wait 20s and look in the raspberry logs which IP the ESP got.
Connect laptop/mobile to wifi “pressurespot”and connect
Enter found IP from ESP in your browser.
Proceed to main config
Main setting table, set the following
Unit name & number + append
SSID and WPA key pressurespot
Client IP block level allow all
Press submit
Press controller tab
Press first edit button and set following – Protocol: domoticz http Next set – Controller IP : 10.42.0.1 – Toggle enabled and press submit
Resulting in:
Next we got to Hardware
I2C interface switch GPIO-4 and GPIO-5
GPIO – SDA: GPIO-4 (D2) change to GPIO-5 (D1)
GPIO – SCL: GPIO-5 (D1) change to GPIO-4 (D2)
Press “Submit”
Devices TAB
Press edit, and select device “Environment – BMx280” from the pulldown menu.
Next, set the following
Name: pressure
Enable on
I2C address : 0x76 ( Is there is no 0x76 of 0x77 .. do a i2c scan on the next tab )
Send to controller , mark this
IDX: give this the number you had given this node (this is the one you have to use in domoticz )
interval 10Seconds
and press submit
In the Devices tab, you should be able to see the sensor with the values (Temperature and pressure)
No values? Do a i2c scan and/or reboot ESP ( You can find these in the tools tab)
Tools TAB
Press I2C scan, when seeing a address like 0x76 or 0x77 use this in previous tabs. Still nothing, even after reboot? Maybe faulty hardware?
Everything okay? Back to the config tab
We are going to set the sleep mode. Warning ! .. when setting this it is hard to get into the config pages again. ESP will startup, connect to wifi, send values and goes to sleep again.
At the bottom set: Sleep awake time 1 sec
Buttons on the raspberry / pressurespot
Red button :
Less than 3 seconds is reboot
Longer than 3 seconds is shut down
Charger can be removed, when the green light is off
Led lights on the sensors
Red light (R2; constant): battery is charging
Blue light (R1; constant): battery is full
Blue light (R1; constant) & red light (R2; blinking): trying to charge, but no battery connected
Add shutdown script to /etc/rc.local
python /usr/local/bin/power-switch.py &
/usr/local/bin/power-switch.py
#!/usr/bin/python
import threading, subprocess
import RPi.GPIO as GPIO
def shutdown():
subprocess.call('sudo shutdown -h now', shell=True)
def edge_detected(pin):
if GPIO.input(pin):
t.cancel()
subprocess.call('sudo reboot', shell=True)
else:
t.start()
if __name__ == '__main__':
try:
GPIO.setmode(GPIO.BOARD)
GPIO.setup(5, GPIO.IN)
GPIO.add_event_detect(5, GPIO.BOTH, callback=edge_detected, bouncetime=10)
t = threading.Timer(3.0, shutdown)
while True:
pass
finally:
GPIO.cleanup()
/usr/local/bin/ledoff.py
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.output(18,GPIO.LOW)
/usr/local/bin/ledon.py
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.output(18,GPIO.HIGH)
Now we can check that grafana is up by loading it in a browser: http://10.42.0.1:3000. If so, you can log in with the username and password = admin and set a new admin password.