interfacing a custom sensor with a picaxe

ArnieW

Senior Member
I'm sure it has been done many ways before, but I'm just thinking through the logistics of building a custom sensor to use with the picaxe.

The sensor itself will be a capacitive fluid level sensor that varies the frequency of a 555 timer. A picaxe (08M?) will use the count command to read the frequency; it will read a temperature probe and then work out a temperature compensated level of the fluid.

My question is how best to send this information to another picaxe. I'd thought of a constant serial stream from the sensor, but then realised that the receiving picaxe would lock up if the sensor failed due to waiting for serin.

What other clever ways are there of communicating a number between 0 and 100 [percent level](preferably only on a single i/o)?

regards, Arnie
 

Fowkc

Senior Member
Use the PWMOUT command and an RC smoother. The voltage on the capacitor (read by READADC10) can be changed by varying the PWM duty cycle.
 

Jeremy Leach

Senior Member
Make the sender raise the line high just before it Serouts. This way the receiver only needs to run Serin immediately after the line goes high and therefore doesn't lock up. It can loop waiting for the line to go high and timeout if counter > x etc.
 

steirny

Member
If you are displaying the temp remotely and don't need a local display, why not send the raw frequency as is, and convert downstream. 555 one end and only one picaxe needed at the other.

Edited by - steirny on 27/03/2007 03:34:19
 

hippy

Ex-Staff (retired)
Ideally two-way hand shaking; "I have data" from the sensor and "please send it" from the master just before entering its SERIN.

If you can provide a reset signal ( power the sensor PICAXE from the master if an 08/08M ), you can kick it back into life if it dies.

The alternative is an external watchdog which can send a known but 'invalid' byte if the sensor doesn't to brig the master out of a SERIN wait.

Thinking about that ... From the work I did with multi-tasking, an 18X ( and probably 18A and 28X/40X ) can generate a timeout pulse by poking the CCP registers, and this could be diode mixed with the sensor serial to fake a $00 byte received using an Nxxxx baud rate.
 

moxhamj

New Member
I wouldn't worry about the serin hanging problem. If the sensor dies then, yes, serin on the receiver will hang, but you will still have to fix the sensor module which is a much bigger problem than serin hanging.

In practice, the problem will be "the system isn't working". You need a quick and simple way of determining if it is the sensor that has died or if it is serin that is hanging on the receiver. Answer is to put a led/resistor on the data line, and send data all the time. If the led isn't flashing, then the transmitter has died. If the data isn't coming out of the receiver but the led is flashing then the receiver has died.
 

ArnieW

Senior Member
Thanks for quick replies - the combined knowledge on this forum is great.

Thinking it through, I could probably have the receiving picaxe look for a high on the input (which it will see if there is serial comms), and then if it finds one use serin to read the data.

If the sensor sends a continuous stream of serial info, then it won't take very long to synchronise and read - but the receiver will only try and read if there is actually data coming in.

Does that sound like it will work ok?
 
Top