...making Linux just a little more fun!
Deividson Okopnik [deivid.okop at gmail.com]
Hello TAG!
Im doing some research in here, and was wondering if any of you ever worked with external sensors.
What i had in mind was having temp/humidity sensors plugged into my computer and reading theyr values on linux to use on some program ill write.
If anyone ever did this, what kind of hardware did you use?
Peter =?iso-8859-1?q?H=FCwe?= [PeterHuewe at gmx.de]
Am Montag 12 Juli 2010 18:48:36 schrieb Deividson Okopnik:
> Hello TAG! > > Im doing some research in here, and was wondering if any of you ever > worked with external sensors. > > What i had in mind was having temp/humidity sensors plugged into my > computer and reading theyr values on linux to use on some program ill > write. > > If anyone ever did this, what kind of hardware did you use?
Hi,
there are several ways to access your sensors.
- attach the sensors to the buses on your mainboard and then use lm_sensors/i2c_tools to read them out.
This works quite well if you have access to these busses like i2c/spi - but unfortunately it isn't that easy (unless you're good with the soldering iron) to attach your components to the busses - if you're unexperienced with this, it is quite dangerous. On embedded platforms (like the atmel ngw100) you have accessible io pins that you can use - there it is really easy.
However since your monitor uses I2C to annouce its EDID/DDC capabilities you can use you vga cable to hook up components -- however this might damage your hardware too;) https://www.lammertbies.nl/comm/cable/VGA-monitor.html -- PIN12 Pin 15 https://www.paintyourdragon.com/?p=43
- use an arduino / bus-pirate
The other, perhaps more sensible method would be to use a arduino or bus- pirate. There you can access the busses and sensors quite easily, you only have to write the software for it. Arduinos are quite useful and easy to use, so they are quite popular among design and multimedia students. There a plenty of arduino clones, ranging from 20 bucks to over 100. https://en.wikipedia.org/wiki/Arduino
Bus pirate is quite useful if you just want to try a sensor out and see how it works. https://dangerousprototypes.com/bus-pirate-manual/
- build your own board using a microcontroller same as arduino, just the hard way ;) on the other hand it might be more comfortable/cheaper.
- buy some expensive hardware ;) Maybe there are even SPI/I2C/IWire expander cards.
If you have any further questions, don't be afraid to ask.
Regards, Peter
Paul Sephton [paul at inet.co.za]
On Mon, 2010-07-12 at 13:48 -0300, Deividson Okopnik wrote:
> Hello TAG! > > Im doing some research in here, and was wondering if any of you ever > worked with external sensors. > > What i had in mind was having temp/humidity sensors plugged into my > computer and reading theyr values on linux to use on some program ill > write. > > If anyone ever did this, what kind of hardware did you use?
Hi, Deividson
I did a bit of reading on this a while ago. There are several approaches. The USB protocol is quite involved, but one can find kits that provide a generic USB interface to an AD converter. Of course, the AD (analogue/digital) converter is the crux of it all. Sensors such as these normally present a varying voltage which the ADC measures and provides as a digital output.
There is a direct relationship between voltage and resistance (V=IR) which simply states current=voltage/resistence. In a circuit, increasing resistance increases voltage for the same current, and increasing current also increases voltage for the same resistance.
The simplest (and cheapest) approach is to convert the reading into a resistance, and use a joystick port for input, which effectively provides four AD pins and four switches. The nice part about using the joystick port is that the granularity of the measurement depends on your processing speed- You trigger and count how long it takes for the port to reset. The bad part is that it is non-linear, but one may calibrate and adjust.
Another approach is to front-end your devices with a microprocessor, such as a PIC, and use the built in PIC/RS232 interface. This might take a bit of work, as the RS232 voltages on the PIC are not enough to drive a TTL load. Standard line driver chips are available to convert CMOS to TTL. Of course there are versions of the PIC that do USB or I2C as a standard too. One may also use other microprocessors to do the job.
Here's some reading material: https://www.sensorland.com/HowPage037.html https://www.brorson.com/gEDA/SPICE/intro.html https://www.beyondlogic.org/usbnutshell/usb1.htm https://tams-www.informatik.uni-hamburg.de/applets/hades/webdemos/index.html https://www.66pacific.com/ph/phschematic.htm
Also look at
https://xoscope.sourceforge.net/ - I actually built that one and almost blew up my computer in the process
Good luck
Peter =?iso-8859-1?q?H=FCwe?= [PeterHuewe at gmx.de]
Am Montag 12 Juli 2010 19:27:32 schrieben Sie:
> Arduino seems to be a great solution - a bit bloated for what im > trying to to actually, but it would work. My best solution would be > something where i could plug the X wires coming from each of the > sensors and read em directly from the computer (a := > read_sensor_value(1); is too much to ask? :P )
Although I'm quite sure this is possible with arduino, maybe you should have a look at octopus
It has a library/wrappers for C, python etc... I used to work on the predecessor (vport) ;)
https://shop.embedded- projects.net/index.php?module=artikel&action=artikel&id=17
Peter
Dr. Parthasarathy S [drpartha at gmail.com]
YES this is quite common in process control. In fact I did a fairly huge project once (nickname SMART_LAB) where we had almost 200 sensors read by SMARTLAB running on a Unix machine. The best way would be to wire your sensors to a front-end (called a remote terminal unit). The Unix box interrogates the frontend every so often and gets the values over a RS 232 serial line. The RTU does all the analog/digital conversion, linearisation etc., and sends data to the main machine. There are many configurations and architectres and protocols possible. RTUs should be available off-the-shelf from instrumnetation vendors in your city/country.
Of course there is the alternative of an instrumentation bus, connected by DMA to you main system.
And of course, you can also tinker with your CPU like it has been suggested in this list.
Good luck,
partha
-- --------------------------------------------------------------------------------------------- Dr. S. Parthasarathy | mailto:drpartha at gmail.com Algologic Research & Solutions | 78 Sancharpuri Colony | Bowenpally P.O | Phone: + 91 - 40 - 2775 1650 Secunderabad 500 011 - INDIA | WWW-URL: https://algolog.tripod.com/nupartha.htm ---------------------------------------------------------------------------------------------