How to determine the power status of a monitor/TV in Linux - linux

I asked this same question a few months ago, but I've run into another roadblock and I'm hoping someone will have a flash of insight. The is the previous thread: Detecting if the monitor is powered off
I'm trying to figure out the power status of a monitor, in particular a TV that is plugged in via HDMI. I'm running Ubuntu 10.10 with nVidia ION video cards. These PCs will be running some digital signage and I need to make sure the power is on to the TV during business hours. I have a working Python script controlling an IR transmitter to turn the TV off and on. The last piece of the puzzle is to know the current state of the TV.
In my previous thread, I found I could use ddccontrol to get information from the monitor. That worked great for a traditional Asus monitor plugged in via HDMI. However, the Vizio TV says it doesn't support DDC.
I've also tried using get-edid to get live resolution and color information, but that fails to return any information from the TV.
I've tried udevadm monitor but an event only fires on the initial monitor plugin.
I have a feeling that the nVidia drivers are blocking these calls to the monitor, but I can't confirm that.
Ultimately, all I'm looking for is a single byte of information that changes when the monitor turns off.
EDIT: So, I'm coming to the conclusion that this may not be possible. At least not consistently possible across various combinations of video cards and monitors/TVs. The next idea I have is to monitor power usage on an outlet. I first looked at Kill A Watts, but they are completely stand alone. After several hours of searching, I came across Digi and their XBee radios. I ordered one of XBee's Smart Plugs from Digi and a XBee radio and USB adapter from Spark Fun. My current plan is to use a Python script that polls the Smart Plug for power usage.
The plug and radio were kind of expensive. Does anybody know of a power meter that plugs in? Everything I found was wireless. I'd like to be able to connect to it via USB, ethernet, or serial.
EDIT 2:
I could never get the XBee plug to work. It's incredibly difficult to configure the plug unless you buy one of Digi's gateways.
I ended up building my own current sensor. It's Arduino based and cost about $60 in parts. I wrote about it here: http://trafficlightads.net/2011/09/06/an-arduino-current-sensor/

I have a couple of Watts up? .Net models that have USB and Ethernet for monitoring devices and controlling devices. The .Net model adds Ethernet and an internal relay to turn the attached device on and off. This could be used to eliminate the possibility of IR being blocked and not being able to transition the state of the TV.
Watts up? .Net Product Link
They aren't cheap, but they are well-built. I recommend getting the international model if you want the most flexibility in outlet type. This allows you to use your own in and out cords. In the USA model the input cord is hard-wired/integrated.
Good luck.

Related

How can I receive Bluetooth audio signal and forward it to a Bluetooth speaker?

I need some help because I don´t know how to approach this challenge.
I want to build a device, that's receiving a Bluetooth audio signal and is forwarding it to a Bluetooth speaker. It´s also running some algorithms with the audio data and also simultaneously sending results via UDP to a different device.
I already thought about using two or three ESP32s, using one with an extra Bluetooth module, or searching for a whole different MCU with Bluetooth 5.0 or higher and Wifi 5GHz. But I don´t know approach the best is, or maybe a completely different one.
Some context, why we want to do it:
We want to create a real-time light show, based on the current playing song. It is already working for PC, but also want to make it accessible for phone users. Sadly there is no way to capture the internal audio on iPhone or Android phones. Our Idea to make the music sync with the phone possible is that you are connected with the phone via Bluetooth to our "sync box" which is then connected to the speaker via Bluetooth or AUX. The "sync box" is running our algorithms for creating the light shows and then sending the data to the microcontrollers from the light strips.
So maybe you have an idea how we can sync the lights to the music completely differently or how I can approach the challenge with Bluetooth.
Any help is highly appreciated.
Thanks a lot.

Bluetooth programming, interface implementation

I am not much experienced in bluetooth programming yet, but for my bachelor thesis I was asked to implement an interface for an blood presure monitor. In general this device is able to connect to other devices in order to share the data via bluetooth. It is also common licenced.
Now the Problem:
I have written an java program using bluecove to search for bluetooth devices. It works, but I can't find the device I want to. This blood presure monitor also has an button for activating pairing, which does not help either. Every time the device is getting new data (I measure my blood presure) it says on screen "transmitting data" so it trys to connect to an bluetooth device it knows.
Is there any special way I need to address it in order to get paired with it? So I would need to create an server waiting for this device to connect to, or is the general task impossible to handle?

Redesigning Ti SensorTag

This is my first question in Stackoverflow :)
I'm trying to make few modifications to the Ti Sensortag but I have few questions please:
1- is it possible to make the sensortags communicate with each-other without a gateway?
(lets Say I put Sensor1 in bedroom 1 and sensor 2 in bedroom 2 can I make them exchange readings without the need for a gateway?)
2- can I install a micro USB over the interface connector to be able to use a portable battery pack? (photo of the interface connector)
thanks
You'll get better more in depth responses on the TI support forums as Ifor has said.
However, I can tell you the answer to #1... Regular bluetooth allows for things like piconets, but Low Energy does not. With LE you have a client/server (master/slave) connection between two devices only. It may be possible to modify the firmware on the sensortags to allow them to make connections to other sensortags, but then they'd have to give up whatever connection they currently had to do so. The master devices can connect to multiple slave devices, but the slave device can only be connected to one master.
As the sensortags are currently designed, I think they only work as a slave (server) device.
Press releases say that the new 4.1 spec allows for a single BLE device to act in both roles--central and peripheral eliminating the need for a gateway. A 4.1 update is, in theory, possible with 4.0 radio hardware like the SensorTag has. I personally haven't seen an example of this however and SensorTag processing resources may be a limiting factor to a dual role.
The Battery Pack connector breaks out VDD_EXT and GND and the SensorTag hardware schematic is available. Analysis by a hardware design engineer should be able to determine the suitability of a USB source powering option.
http://processors.wiki.ti.com/index.php/SensorTag_User_Guide

How to attach physical sensors to computers? (infrared, laser)

I am working on a project where I need to attach a sensor to the computer like laser sensor or an infrared sensor, to use in a foul line detection. Basically the idea is, if someone steps on the foul line, the laser or infrared will be blocked by person's foot, and the laser/infrared won't be received by the receiver, causing the sensor to send a signal to the computer.
The problem is, I don't know where to start something like this. How would I go about attaching a sensor to a normal computer (like a normal PC that we use)? If someone could direct me into a direction or has any inputs, that would be really appreciated. Thanks a lot!
You may want to look at Arduino (http://www.arduino.cc/). It is an open-source microcontroller that can be used along with a computer and is designed to be hooked up to various types of sensors. It also has an extremely helpful, active support community.
There are several approaches to the task of bringing the sensor signal into a PC (to take advantage of PC's computing power, good user interface, connectivity to the web).
Look for integrated sensors that have an interface for attaching to a PC (RS-232, USB, Ethernet). For example, you may find something useful by googling photodetector USB.
There are I/O (input/output) devices for PC. They have analog and digital inputs and outputs. Look up LabJack, National Instruments USB-6008 and dozen other types of commercial USB I/O boxes.
Connect sensors to a microcontroller (uC), then connect uC to the PC through a USB or RS-232 or Bluetooth (the list goes on). This involves more hardware. You'll need to write firmware for the microcontroller too.
Obviously, which approach to choose depends on your skills (or willingness to acquire new ones), timing, budget, team structure (if it's a team effort).
You could use a photo-transistor and a Yocto-Knob. The Yocto-knob is an USB device able to quickly detect resistivity changes, you just have to connect the photo-transistor to it. Here is an application which looks pretty similar to yours: they use a light barrier to detect and photograph a fast object:
http://www.yoctopuce.com/EN/article/how-to-drive-a-camera-shutter-automatically

Bluetooth UUID discovery

Does anyone know how a bluetooth device could pick up the discoverable devices' device IDs in range?
I am ideally looking for the simplest solution that involves the smallest implimentation of the bluetooth protocols.
A starting point would be good, I just wish to create a device that can store all the device ids of nearby bluetooth devices with minimal power consumption, preferably just using radio frequencies and not SDP and whatever else.
If you can't help me with this, please can you help me find good reading material for low level bluetooth (step by step) communication. The reading online is so high level that I cant work out what is actually sent, when.
Laalto nailed the answer from the Bluetooth spec/stack POV, but your question implies your looking for a stand-alone Bluetooth device - not just a laptop app scanning surrounding devices.
I can only speak for the BT chips that the company I work for manufactures (Cambridge Silicon Radio - CSR) but our chips can do that pretty much out of the box. Our chips have an on-board Virtual Machine sandbox that allows access to the firmware functions and Bluetooth stack of the chip. You can easily write a C code app to run in the virtual machine sandbox, on chip, that periodically scans for discoverable devices around, grab their ids and then download them when connected via USB or Serial, or maybe over BT when a device connects to the listener directly.
www.csr.com and www.csrsupport.com for chips, dev-kits, design references, etc.. etc...
You probably want a module with the extra HW (UARTs, USB etc...) as well as just the chip but you could implement this with something the size of a BlueTooth USB or probably smaller.
It would really help to know more about what your trying to achieve, why you want something that just scans the surrounding bluetooth devices and how big the device needs to be.
Sorry if this sounds like advertising. For balance: Broadcom make BT chips too!
The Bluetooth specs from http://www.bluetooth.org are a good starting place for low-level information. You need an account to access the specs, but you can create one for free.
Basically what you need to do is to go into Inquiry mode periodically and grab the response packets as they arrive. The more time you spend in Inquiry mode, the more likely you will discover devices in range: discoverable devices enter the Inquiry Scan mode only relatively rarely; it takes some time (10.24s at least with older Bluetooth versions) to scan all the possible frequencies in the Inquiry/Inquiry Scan frequency hopping schemes. And even then you can have suboptimal radio conditions.
For implementation I suggest you at least start with existing Bluetooth libraries such as BlueZ and do not attempt to create your own from scratch.

Resources