Arduino Forum

Forum 2005-2010 (read only) => Hardware => Interfacing => Topic started by: AltairLabs on Jan 01, 2011, 12:45 am

Title: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: AltairLabs on Jan 01, 2011, 12:45 am
Folks want a cheeep way to get temperature wirelessly.  Ladyada points out that an Xbee node can digitize and report an analog input with no additional processor at the sensor. However theres a technique MUCH cheeeper than that which I share with you here.  It can be extended to three parameters per transmitter, like temperature, humidity and light; or even more.

Dirt cheepest wireless links are SAW oscillator TX ($4) and PLL RX ($6) from sparkfun and others.  They use On-Off-Keying (OOK) so you just get 1 or 0.  You dont need a UART for these, they will pass a wide range of pulse width and frequency.   Most sensors can be converted to a pulse train with just a few cents of parts, no need to waste a processor.

Turning pulses back into sensor readings is done at the main processor.  Tasks formerly done at the sensor node such as calibration and linearization using software and/or hardware are now done at the main node entirely in software.  Hardware costs $$$ but software costs only time, and you got plenty o' that, right?  

This is an oscillator controlled by a thermistor.  The gate is a CD4093 CMOS quad NAND with Schmitt Trigger inputs.  Any inverting gate works here, the important thing is the Schmitt Trigger or hysteresis inputs to give a "snap action" transitions.  The choice of NAND gate will help us later.

More on CMOS oscillators at Fairchild app note AN-118

The type 103AT thermistor has a 10k resistance at room temperature, rising to 330k at -50 deg and dropping to 974 ohms in boiling water.  DigiKey carries these or just get RadioShack 271-0110. Same same. Temperature-resistance curve is in datasheet  Capacitor is 0.1 uF for weather and habitable spaces, running around 1 kHz.  To keep the pulse frequency in a convenient range, use a smaller capacitor to raise the frequency if monitoring a dry ice bath that never exceeds room temperature; or a larger capacitor to decrease the frequency to accurately monitor a steam boiler that never freezes.  

The sensor works quite satisfactorily off a 9v battery. But when the battery sags the frequency may drift a few percent before dying, Fairchild cites a change of 4% when supply varies from 15V to 5V, so add a voltage regulator if this is not good enough for you.  

On the main node the receiver is hooked up as normal and data connects to any digital input.

Code measures the frequency or period, using pulseIn(pin, value) is the easiest way.  Pulse period is proportional to thermistor resistance, and temperature comes from the thermistor curve by interpolating off a lookup table or by fitting a polynomial.  

Calibration is not taken care of by the dumb transmitter so the smart receiver must take on this duty.  A quick two point cal in ice water then boiling water is sufficient for most needs.

Notice either R or C could be varied to sense a parameter.  Taking advantage of this fact, and our choice of NAND gate, we kick it up a notch by "multiplexing" two sensors onto one transmitter.


U1A and U1B are "gated oscillators" see Fairchild data sheet for the CD4093 they are enabled one at as time by the 555 and U1C and are combined at U1D.  Here the capacitance of a Humirel humidity sensor and a fixed resistor determine the frequency of U1A.

The pulse train now alternates between two frequencies.  Note that the gated oscillator has one stretched pulse when its first enabled, so the only pulses of interest are the 2nd onward up to last one before the next alternation, which might be cut short.  

One simple way to handle this is make sure the freqs do not overlap, so the "A" tone and the "B" tone are in different ranges. The receiver software waits for tone A to change to tone B, takes a measurement of B well before the next change, then waits for tone A to come around and be measured.  

A radio scanner works great to monitor and verify tones during test and development, use AM modulation and tune to the RF frequency of your link.  

In the circuit above tone A will be around 6 to 7 kHz and tone B will stay well below that until near boiling point.  The Humirel sensor needs temperature correction which can be done by the software, see data sheet;

Another multiplexing scheme is change the 100k resistor on the 555 to 1 Meg, which makes one tone last about twice as long as the other.  This way two identical sensors could be used covering the same range of tones, like two temperatures using identical oscillators and thermistors.  The receiver tells sensors apart by duration when the tones are different.  When the tones the same then so are the readings.

Our last example for three sensors uses few components.
In this case tone A is ambient light, tone B is temperature, and the rate they alternate is the humidity.

The 555 oscillator circuit uses special component values to hardware-compensate the humidity sensor for temperature, and runs from 7155 Hz @ 10%RH to 6210 Hz @ 95%RH. The CD4060 divide-by-14 brings this down to 0.4367 Hz to 0.3790 Hz.  Humidity sensor response is slow, so we allow this parameter to take the longest to measure, the time it takes for one complete cycle from tone A to tone B and back.

Tone B is set by the thermistor and stays between 0.3 and 3 kHz unless boiling or cryogenic temperatures are encountered.

Tone A is set by a CdS photoresistor, from DigiKey or pack of 5 for $3 as RadioShack 276-1657.  The very wide range of CdS resistance presents a challenge.  In full sunlight this resistance may be under 200 ohms, in total darkness it may go to few Meg, a ratio of 10,000 to one. Even a simple single-tone data link might not follow the highest and lowest tones. Check the data sheet, or else use a 555 or something to make a square wave and test the highest and lowest pulse frequencies your data link can pass.  Gotta stay within these limits,  narrower than the range of illumination you may encounter.  Adding fixed resistors makes this possible.

To tell the difference between full sun and cloud cover, we can discard resolution on the "dark end" by adding a 2k resistor in parallel.  The tone is now compressed into a 10:1 range near full sun, with good resolution, but the difference between moonlight and no moon might be only an LSB or two.

Conversely, 100k in series gives best resolution in candle light or star light, but only an LSB or two below max scale when clouds cover the sun.  

NOTE this is not a limitation of the dumb wireless sensor, the "dynamic range" is also just too darn wide for a 10 bit analogRead or Xbee input.  Either Smart or dumb sensors must discard ranges not of interest, or use a log amp to cover the full range while sacrificing resolution equally everywhere.  

The techniques for compressing the CdS photoresistor dynamic range show how the dumb sensor circuit can easily accommodate such sensors.  Furthermore your dumb sensor can actually exceed the precision of a smart one.  Measuring one cycle of a 1kHz tone with microsecond resolution gives about 10 bits of resolution, like an analogRead().  By measuring the period of 1000 cycles (1 second) of the same dumb sensor tone you could approach 20 bits of precision!  

Remember that 20 bits of "precision" is a function of resolution and linearity. it allows you to see small changes in large parameters.  To get 20 bits of "accuracy" your dumb sensor, same as a smart one, must have that precision PLUS ALSO be absolutely calibrated and be stable over the long term, requiring a voltage regulator, and maybe precision low temperature-coefficient components and such.

Many independent oscillator channels may be multiplexed by clocking a binary counter (CD4029, etc) and multiplexer (CD4051, CD4067, etc), just as long as one tone (or gap) in the sequence is unique from all the others to mark the start of the sequence.  The receiver software looks for the unique tone, then increments through the readings.  No "tone change detect" is needed for each sample, just wait for the "index tone" to end plus a short delay, then measure once every tone period to get a "pure" sample from the middle of each period, no "startup" or "cutoff" pulses.  After the last sample period, wait for the index tone to resync and start over.

Low power is achieved by using CMOS, low speeds and high resistances.  Type 104AT thermistor and a 0.01 uF will cut that oscillator power by 10x.  Transmitting a narrow "ON" and wide "OFF" cuts power in the RF link.  Also leaving gaps between transmissions; eg count thru 16 channels at 2 per second then sleep for one minute to extend battery life by ~7x.

Dumb Dirt Cheep Wireless Sensors may not be everyones cup o' tea, but I hope you can see how a $10 wireless node can radio home a few parameters with comparable accuracy and precision while requiring no processor and no A/D converter.

Length limit for a post, STFU!
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: tkbyd on Jan 01, 2011, 10:04 am
The same could also be used for wireless "keys", like the ones many of us use to lock/ unlock our cars. If you haven't visited Sparkfun yet, do it! LOTS of fun toys to play with. And a great forum for Sparkfun-product-specific questions. (And no, I don't have any connection with them beyond "happy customer"... and if the OP DOES have a more direct connection, I for one feel that the valuable content in his/her post more than makes up for any "advertising" element.)

will take you to the page about the $4 transmitter

Note the following, which is quoted from a user post on that page...

Sparkfun say: "Only one 315MHz transmitter will work within the same location." Only one can work at the same instant, but for datalogging, with message transmissions of a small fraction of a second, many can work in the same space provided that you understand and work around the possiblility that collisions may occur with resulting data loss--so transmit multiple times with varying gaps between transmissions.

Note, oh international readership, also that the rules about what RF devices are allowed vary from country to country. The link above takes you to a 315MHz device. Sparkfun also sell a 434MHz version of the same thing... plus fancier RF modules.

To expand my "key" idea: Fit a transmitter with two square wave generators (two time something similar to the temperature sensor circuit. but with a simple resistor in place of the temperature sensor.) Each "turned on" by pressing a button. The system behind the receiver "watches" for first a brief "send" of the first freq, then a brief send of the second.
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: AltairLabs on Jan 01, 2011, 10:00 pm
Well THANKS martin_bg am takin that as a compliment.

A board might be a good idea, although it sorta takes the "sport" out of roll-yer-own.  The main problem is theres SO MANY DIFFERENT sensors and ways to use them, a pre-made board would limit the possibilities.  Maybe I'll try to puzzle up some design thats tiny, low-power, and CHEEEP and has enough optional components / pads / jumpers to stay flexible and meet as wide a range of needs for as many folks as possible.

OK lets pretend we do it:

Folks here seem to want temperature more than anything.  What else?

The Holy Stone MO-SAWR-AS series is pretty cheep and popular in these regions of the innerwebz are there any others to be compatible with?
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: AltairLabs on Jan 02, 2011, 06:24 am
Richard Crowley could I contact you please?
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: AltairLabs on Jan 02, 2011, 06:31 am
Been thinkin 'bout youur suggestion tkbyd, a switch contact is probably more commonly needed than temperature.  Am working up a mod that takes either NO or NC contacts.  The NAND only keys the TX when (at least) one gated oscillator is active, so the TX is quiescent in between to save battery.

A keypad with only 2 tones could be used to enter a short security code in binary.  "AABABB"

Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: martin_bg on Jan 02, 2011, 09:53 am

I deleted instead of editing it,

re-posting for the sake of the thread:

I wrote:

"I would buy these boards if they were manufactured as a breakout board"

I am not good at hardware, but was looking for some cheap remote sensing. this looks like a promising idea.

I think it can be also extended to work both ways, i.e. remotely activating a relay over wireless, maybe coding the signal with certain response frequency
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: martin_bg on Jan 02, 2011, 10:10 am

that is a gift for spam engines, I suggest you edit your post and PM your email :)
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: AltairLabs on Jan 03, 2011, 04:39 am
Replied to your PM tkbyd, unable to PM rcrowley.

Folks seem interested in several things that are possible to cram into a 555 and a quad NAND.  I have whupped up a Dumb Dirt Cheeeep Wireless (DDCW) circuit that can be configured for several modes :

One or Two button remote :
One or Two channel alarm contact :
Single or Dual channel environment sensor :
Dedicated precise humidity sensor :
Single channel "battery saver" sensor :
Dynamic data range compression for one or two channels :

Dumb "programming" is done with 7 trace cuts and/or 5 pull up resistors.  


Included a linear voltage regulator (for high accuracy) but it could be jumpered out (to save battery) and still have a single common PCB for all DDCW configurations.  This would fit on a coupla square inches of PCB, run off a 9v battery, or anything between 7 and 12 v and provides power and data to an RF Transmitter module that could plug or solder right on the end.

A board like that might sell for $25 in prototype quantity, BYO transmitter.   Naked PCBs get awful cheep in quantity, thats where everyone benefits by having a common PCB that supports many configurations.  If they got wildly popular and the community pools purchases of parts and boards the cost could come down by 2/3 or more.  
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: luksedj on Jan 03, 2011, 05:52 pm
Would it be possible to limit transmits of the sensor to once a minute?
I'm really new to arduino & electronics, so i don't have a clue yet.

It makes sense to limit e.g. temperature readings to once a minute in order to save battery power...
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: macegr on Jan 04, 2011, 01:07 am
Continuously transmitting on 315 or 433 is definitely a problem, the FCC open license is only for intermittent use. They will in fact interfere with car remotes. I found this out one morning when I had left a project running and my roommate knocked asking "what did you do" because his car remote wouldn't work anymore.
Title: Dirt Cheap Dumb Wireless Sensor
Post by: AltairLabs on Jan 04, 2011, 02:44 am
Yes, macegr, luksedj, thats exactly the stuff I was thinkin of when I added the mode

Single channel "battery saver" sensor :

In this mode the user can cut a trace and add a jumper to disable Oscillator A, so the TX alternates between Osc B and radio silence.  The 555 is setup per all the data sheets and tutorials, using a good sized C2 to increase the time as wanted.  Use a large R4 and a small R5 to make the duty cycle as low as desired, even a few milliseconds every few hours if you really wanna get carried away with battery savings.  The normal 555 timer circuit duty cycle is 51% to 99.999999% so Osc B is the one we want to use for battery saving, as U1C inverts this into 49% to 0.000001%.

I think the limit on duty cycle is how vigilant your Arduino sketch can be and how quickly it can aqcuire the pulse rate to your desired accuracy before the burst is done.  This hardware can probably exceed what the sketch can do, so dont make R5 too small !

Of course this little hack cant do *everything*, but IMHO its quite a versatile circuit for dirt cheeep simplicity, which is what I was striving for.

The holidaze are over, hit it hard in lab all day, no proper lunch, and am just now home.  If enough folks are interested in things this can do it would be nice to get together some prototypes to play with.  But, alas, the holidaze are over...
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: macegr on Jan 04, 2011, 03:52 am
I do like the concept. Another approach would be to use one of the really low power and cheap microcontrollers like the PIC10 or ATTiny or MSP430 series. Some of the PIC10's are less than 50 cents. You have to program something instead of pulling stuff off the shelf, but now you only need one part that can handle data acquisition, pulse timing, randomized transmission interval, etc.
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: gardner on Jan 04, 2011, 04:07 am
If you had a handful of transmitters, all on the same frequency, transmitting at various intervals, it would be useful for distinct transmitters to use different subcarrier frequencies or something, to allow the receiver to determine which is which.
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: Grumpy_Mike on Jan 04, 2011, 01:21 pm
The main problem with this is that in a large part of the world it would be illegal to use this. I suspect that it is also contravening the FCC regulations with regards to the carrier frequency stability and output power.
Title: Dirt Cheap Dumb Wireless Sensor
Post by: AltairLabs on Jan 04, 2011, 04:58 pm
macegr youre right about the 50 cent PIC, DCDW is indeed pickin a fight against the illustrious Gordon Moore, he will eventually win.

BTW wish we would have called this thread "Dirt Cheap Dumb Wireless", DCDW.  Einstein later regretted not calling his famous work the "Theory of Invariance".
Title: Dirt Cheap Dumb Wireless Sensor
Post by: AltairLabs on Jan 04, 2011, 05:21 pm
gardner, Grumpy_Mike,

Youre partly right, except the sparkfun wireless ARE legal.  The freqs 315 and 433 are authorized for use subject to restrictions.  They are Govt frequencies.  The key to understanding legality of these is the terms "PRIMARY", "SECONDARY", "CO-SECONDARY", "LICENSED", "UNLICENSED" and "HARMFUL INTERFERENCE" as defined in CFR 47, which is the telecommunications law of the USA.

315 is military UHF for aviation, the sparkfun TX (actually IIRC made by HolyStone) are authorized as UNLICENSED CO_SECONDARY devices with relaxed technical specifications and low power.  

CO-SECONDARY means if a primary user come to you and says knock it off you must knock it off.  Any PRIMARY user may complain at any time that you are causing HARMFUL INTERFERENCE, and their complaint instantly has force of law, and without any further notice or legal action on their part any further operation on your part at that location is now illegal.  

UNLICENSED means you kowtow to LICENSED CO-SECONDARY users also.

433 is military radar, similar situation.  Ham radio are LICENSED CO-SECONDARY and may legally run hundreds of watts, and can legally shut you down with a single complaint.  But in turn several UHF repeaters in ham band were shut down, re located, etc. due to proximity and HARMFUL INTERFERENCE with nearby PAVE PAWS radar sites who are PRIMARY.  

Its a food chain, and these UNLICENSED devices are at the bottom, but are *absolutely legal* under the restrictions given.  Otherwise FCC could come down on SparkFun for selling them.  Obviously its illegal to use with a power amplifier, not so obviously it also may be illegal to use high gain antennas.  

Globally, other nations in ITU region 2 have similar rules, the other two ITU regions may vary somewhat more.  From the ITU the US Executive Office inherits frequency spectrum by international treaty, which is delegated to Commerce Dept and down to NTIA.  From there the NTIA divvies it up and coordinates between FCC for civilians and DoD for military.  We little civilians get ours from FCC.  

See the NTIA chart of US Allocations at

Title: Dirt Cheap Dumb Wireless Sensor
Post by: AltairLabs on Jan 04, 2011, 05:38 pm
Although my SparkFun modules have not yet arrived they should come with a legal notice
This device complies with Part 15 of the FCC Rules. Operation is subject to the following two conditions:
1. This device may not cause harmful interference.
2. This device must accept any interference received, including interference that may cause undesired operation.

I forgat to mention the second condition of being UNLICENSED CO-SECONDARY (bottom of the food chain) is that you may not complain about anyone who outranks you, no matter how much HARMFUL INTERFERENCE they cause to *YOU*.   ;D
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: jomac_uk on Jan 10, 2011, 02:54 am
Hi Guys, Ive only just found this topic, and its a subject close to my heart, so i joined the forum. Ive recently purchased an Arduino clone, the Seeeduino, so it will take a little time for me to get upto speed on the software side of things, hopefully i will soon be able to offer my contributions in the near future, so in the meantime excuse any dumb questions guys.

John UK
Title: Re: Dumb Dirt Cheeep Wireless Environment Sensor
Post by: AltairLabs on Jan 10, 2011, 10:43 am
Welcome, John from UK, the development is proceeding under the name.
Dirt Cheap Dumb Wireless  =  DCDW
on a new Arduino Forum thread
and new web page
youre in plenty time to join in