Wireless multi PICAXE18M8-based sensors to single 18M8-based receiver

Novaree

New Member
Hi guys,

I have a stash of 18X8Ms and various other components, that I though I'd use for a home monitoring system. My only requirement is, that communication between sensors and receiver should be wireless (ie 434MHz based).

My idea is the following:

I'll build a range of "dummy" sensor units with the various sensors (temp, moist, etc) and a 434MHz transmitter. Each unit will have an ID and at a given interval - by deafult once every (15 minute + unit id in seconds) to prevent clash of transmissions - each unit will transmit the collected data in sequences of three - inspired by another application found in this forum, to make sure data is received. The transmitter is planned to be of this type: http://www.sparkfun.com/commerce/product_info.php?products_id=8946

On the receiving end, I'll have an 18X8M unit with one (or maybe two if I can find some reason) of these: http://www.sparkfun.com/commerce/product_info.php?products_id=8949. The unit will be attached to a PC onto which the transmitted data will be dumped.

Does this sound as a plausible solution? Should I approach this in a different manner?

Best regards,

Casper Helenius,
Denmark
 
Last edited:

hippy

Ex-Staff (retired)
Welcome to the PICAXE forum.

It sounds a plausible setup but note that all PICAXE's may lose and gain time just as a watch does, and this may be more noticeable with PICAXE's which use an internal rather than external crystal oscillator. Thus, while the system may start without any contention in transmitting, they may slowly drift into times when there are contentions. This can happen no matter what delays you have or how transmissions are staggered.

There is no real way round this unless the transmitting PICAXE's are all synchronised or can tell when contention and data collisions have occurred. With basic 433MHz configurations that may not be easy or possible.

The big question is; how many transmitting units will you likely have.
 
Last edited:

Novaree

New Member
The Big Answer is up to 8. I would like one outside in our garage (if it is within tx range) for reporting on our bird cage, another 6 for home env. monitoring inside the house, plus one for the basement for monitoring potentiel water leaks.

My original thought was to have the sensors conserve as much power as possible while not fetching and transmitting data. Would adding an external crystal osc. have any impact on this?
 

BeanieBots

Moderator
Neither the 18X or 08M use external oscillators:confused:
If you were thinking of using a more accurate time measurement, then it won't help. It will just take longer before the enevitable data collision occurs.

To save on battery power, you need to run as slow as possible.
Use the sleep command and tie unused inputs to 0v.
There have been many threads on this, have a search. (eg underclocking)
 

Dippy

Moderator
Data collisions will happen, as said, sooner or later with a one-way system i.e. a pile of Txs talking to an Rx unit. It's all about probabilty and Sod's Law.

But don't let it upset your plan if the system is non-crucial.

I assume each Sensor-Tx unit will just send a quick 'block' every few minutes? With slightly differnt times-between-Tx for each unit? And if the Rx misses one or two messages then it doesn't really matter?

Consider; the greater the ratio of Tx-Period / Period-between-Tx then the less likely a collision.
So, keep the Tx period as brief as possible.

Then if you have simple error checking in your RX code the Receiver can check the data and if it sees a 'silly' it can ignore it and wait for the next transmission.

Consider another simple approach: If all the Sensor-Tx units send data for exactly the same time periods then a simple ID-Data-ID packet format could be used. If the Receiver checks that both ID values are valid (and the same value) then it is unlikely that there has been an RF overlap. Any unwanted overlap will corrupt one end byte or the other, so it will (hopefully) be obvious that a collision has occured.

Also, the receiver could check for 'stupid' numbers. Example: You won't get a temperature of 300oC in your bird cage (unless it's on fire).
The receiver code could also check for unlikely changes in latest value compared to previous value.
The receiver could also count the bytes.

Obviously there are many more complicated and better ways for error checking, but try and keep it simple and understandable during the early days.

I'm sure you can get it sorted nice and simply without recourse to some complicated algortihm which someone copies and posts from some website :)
 

manuka

Senior Member
Novaree/Casper: Just what is an 18X8M ?! Unless you use transceivers that can listen before sending, you'll indeed run the risk of data collisions. Resending may be the only viable option. However I suggest you first grab a UHF scanner & monitor the local 433 MHz band. In many urban areas many signals now clutter this spectrum slice, & your setup may be swamped unless quality units are used! What ranges are being considered? How will you power these units? Are wired units out of the question? What is your budget ?

Later 08Ms can sleep at µA level current drains under BOD (Brown Out Disable) . However they will NOT awaken until this sleep is worked out, meaning a sudden emergency (flooding?) may not be promptly detected and alerts suitably sounded. Flash flooding can wreck basements in minutes, so this may need consideration! Stan.
----------------------------------------------------------

Dippy- it's barely 6am on a Friday, & I'm indeed up early!
 
Last edited:

MFB

Senior Member
Would it be possible for a PICAXE to transmit only when it detects an anomaly? Alternatively, introducing an element of randomness into the transmission timing would reduce the risk of collisions but you would still need to add a checksum to deal with those that did happen.
 

Novaree

New Member
Manuka/Stan: Bear with me on the model on this one, the model number is taken straight out of memory and may be a little (somewhat) off. At the moment, my stash is kept in anti-static bags in the basement, and - admitted - it's been a few weeks or more since I had a looksee at them the last time. (It's either 18 or 24 pins - I seem to remember that it is definitely 18 pins)

The motivation for this project is actually "just" the flood indicator: As most other areas of the planet, we're experiencing increased heavy weather, and I'm getting somewhat tired of being surprised by water in tge basement - at present, by basement entrance is packed up with sandbags, as the plumbing has been fitted with flood safe devices, so now it's "only" water coming from the outside that's the problem - and when it comes in, it's through/under the basement door :( Thus, I would like some sort of remote guard near the basement door, that could detect water seeping through, so I could eventually flick on my pump if needed.

The home env. measuring is just for showing off, really. I have the single-wire temp sensors, so I figured "Why not?" With the relatively many inputs on the PICAXE, I would - eventually - expand the functionality of each sensor to also support monitoring of doors and windows opening, movement sensors picking up (unintended) movement, etc., thus adding some sort of home monitoring to the system as well.

However, at the moment I'm just brushing up on my good ol' electronics skills. I'm a skilled computer enginner, so neither analog nor digital electronics are far fetched for me: Putting together a PICAXE with a one-wire temp sensor, a batterypack and a 433MHz transmitter should be a rather easy task.

The consistency of data is not military-grade crucial. After all, it's a hobby project, it's for fun (well fun and keeping the basement dry ;)) and not much more (at least not at the moment). Packet collision can - as suggested elsewhere in the thread - easily be handled with checksumming. Otherwise, I might just add a complete transceiver to each sensor, so the receiving end can acknowledge the reception of a packet.

I'm not saying that I am on an unlimited budget, but my timelime is unlimited and only controlled by how much more water I'm willing to pump out of the basement ;) My first milestone is to have the receiving end plus two sensors up and running, as a proof of concept. Then new sensors can be added along the way, when money and time are available. (The worst part is, that I definitely have more money than time)

Thanks a lot so far for your hints, tips, and suggestions. Keep them coming. If my application description is completely way off, please do let me know.

//Casper/Novaree
 

Dippy

Moderator
Well, if you are going from transceivers then use polling. Receiver asks each Tx unit in turn and gets a reply. No collisions. And if using something ready-sorted like XBee your data would almost be flawless.
Checksum/Parity errors could just tell receiver to ask for the data again. Easy.

Or keeping with the original; if non-important things transmitted every few minutes, but when something important significant happened the Tx unit increased transmission to every few seconds then you'd increase the probability of getting the data through.


Interesting project and I think you now have all the ingredients to have this built by tomorrow :)
 

manuka

Senior Member
Basement Flooding/ Louisiana Levee basics 101 - ensure early warning alert systems perform.

I'd not trust any simple battery powered wireless system in such an application as yours. Basic XBee systems, for all their charm, have very short ranges unless line of sight (LOS). Just what ranges & propagation obstacles are being talked about here? Stan.
 

Dippy

Moderator
1. get an antenna :)
2. Polling methods will intrinsically increase reliability/confidence.
3. Put a small child with a Klaxon in your garage/basement as backup for flood warning.
 

Novaree

New Member
The measurements of the house is about 7 x 12 meters and 14 meters from northeast to southwest corner (~21x36 ft and ne<->sw 42ft), build with a concrete foundation (the walls of the basement) and outer walls of some other concrete type of stone. The inside of the house is actually just wood and plaster so I'm not counting on any big transmission problems.

For the garage sensor, I think I'll have to keep it wired, but I can live with that.

I've considered XBee, but I think 443MHz are easier to buy. After all, every expense has to be approved by the CFO ;) I remember XBee to be a bit more expensive than the 443MHz units, so even adding both an rx and a tx module to each component would still be cheaper - and possibly work just as well - than going XBee all the way.

Am I wrong? :)

And yes, apart from missing battery packs and missing rx/tx units, I am actually more or less good to go :)
 

Dippy

Moderator
There are so many varieties of 433/434 MHz modules a simple comparison is tricky.

You can get single cheapoes and multi-channel not-so-cheapoes.
Some 433/434 MHz 'smart' modules from 'proper' manufacturers can be very expensive.

XBee is NOT cheap, but in my experiences is nearly flawless in it's performance.
And it is reasonably small.
I've had a mixed bag of results wrt radio range. I found the built-in chip antenna a bit iffy, but the plug-in antenna a lot better.

I only mentioned XBee as an example, I would choose 433/434 as my first test because of better range/penetration for your money. However, I would use modules from a better manufacturer.
For ease I would always consider RF modules with RSSI - it is a useful option for the extra quid. Or a 'smart' module where the nitty-gritty is done for you by people who understand it properly.
 

hippy

Ex-Staff (retired)
XBee may not be cheap but then not ridiculously expensive either. 433/434MHz modules may be cheaper, but when comparing like with like, XBee = Transmitter + Receiver, I've found the cost to be generally comparable.

XBee range may be an issue ( and may be resolved but at greater cost ), but then it has advantages that cheap 433/434MHz modules generally do not. The whole transmission contention issue can just disappear with XBee. It may be possible to build some sensors using just an XBee, no controller needed.

It is really about getting the components which do the job, whether 433/434MHz, XBee or something else. Saving a few dollars may be false economy if it ultimately doesn't do as intended or the effort put in to make it work exceeds that saving.

Ther's also 'time to market', even for personal projects. I learned a bitter lesson in that while designing and building a car alarm and immobiliser only to find the car stolen when I walked out the door to fit it. Do you want something quick and simple, installed and be ready to move on to another project, or something to tinker with, prepared to put in more time and effort to make work ? There are many other factors as well as just component costs.

There's also a real danger in commercial and DIY projects of 'functionality creep', because it's seemingly easy to do something else as well and won't cost much more, but that may ultimately reduce the originally intended and essential functionality as well as making it all increasingly complex, more difficult to get working.

For a basement flood alarm, a modified wireless door bell may be all that's needed. Maybe not, but always best to take a step back and review how where you're going meets with what you actually need.

My worry of car theft was ultimately solved by the low-tech and low-cost purchase of a 'crook-lock', a locking metal bar which clamps gear stick to handbrake, and removal of distributor rotor when particularly paranoid.
 

Novaree

New Member
How does XBee work with an existing WLAN? Are there any chances of interferrence? If so, any recommendations on which XBee modules to look for?

I totally agree with you, hippy, that there is no reason to build a rocket just to take a cruise downtown - except for the fun and challenge in building a rocket, I guess ;) By the way, I think I remember something about the first burglar alarm being invented by a dane (I'm danish, by the way). Unfortunately, it was stolen :S Kinda like your car alarm :)

I'm not ruling out XBee just yet, I guess I just need a little guidance as to which modules could fit my needs. Suggestions are more than welcome :)
 

Novaree

New Member
Well, browsing the digi.com website, I figured that XBee modules in a DigiMesh would be really nice. It could ensure comminucation across longer distances - at least through repeating packets from sensor to sensor - and only at double the costs of the 433/434MHz components. Still a bit worried it would clash with my WLAN, but I guess I could switch channel and keep the air around the 2.4GHz free for the XBee comm.

I think I'm about to have my application somewhat designed :)
 

BeanieBots

Moderator
Have you read this:-
http://www.rev-ed.co.uk/docs/axe210_xbee.pdf

Rev-Ed do a starter kit which includes everything you need to create a comms set.

You can set a different channel to your WLAN to avoid clashing with it.
A really useful piece of software is "inSSIDer".
It is a free download and will show you signal strength and channel number for wireless networks which will help to select a clear channel.
 

hippy

Ex-Staff (retired)
XBee should co-exist happily with WiFi LAN's but there's never a guarantee of anything on unlicensed spectrum.

I'm seeing a number of complaints emerging from Radio Hams and ADSL users about PLM ( ethernet over in-house mains ) causing problems and interference, some resulting in OfCom going around and closing down household installations in the UK. Something to research for anyone considering going in that direction.

There are other mains-power options; X10 which never really took off in the UK as it appears to have in the US. Not sure about the rest of Europe and eslewhere. Perhaps that could be used on lighting rings and spurs if a proper 'socket supply' isn't available.
 

Dippy

Moderator
I have done a lot of XBeeing with WiFi nearby. No issues... for me anyway, luck maybe.

Don't get too involved in meshy details. Forget things like ZigBee.
XBees, if the range works, will work out of the box in broadcast mode (default).
Channel changes can be done by simple commands from Host if really needed. Repeats can be automated.

They are easy, they work. Ten minutes and you'll be sending your packet. A lot of 'work' is done by Xbee.

However, when I did a lot of 433/434 Mhz transmissions (packetised bursts) it mucked up my DTV (Freeview Band A for me so a case of NSS).... even my neighbour commented the following day that his Freeview was misbehaving every so often. Of course, I knew nothing about that. Shame it didn't unlock his car :)
 

manuka

Senior Member
My home is festooned with 2.4GHz devices (cordless phone, WLAN, Bluetooth,XBee etc) & they all seem to happily co-exist. Even 2.4GHz neighbourhood activity is benign. Basic XBee has only a 1mW Tx power, & even thru' timber/plaster this will not have much punch, giving ranges (10-20m) akin to cellular BT. Even body shielding will block the signal! The more powerful (& sensitive) XBee pro may be hence needed, or decent 2.4GHz antenna - or both.

IMHO you are advised to initially trial some cheap reputable 433 MHz offerings, but (as already mentioned) extensive local spectrum activity (radio hams, wireless doorbells, backyard weather stations,energy meters,garage door openers etc) may near overwhelm. My neighbourhood has numerous 433 MHz tweaty tones that sound like a dawn chorus at times. Grab a UHF scanner & first check the local 433 MHz ISM band! Stan.
 
Top