Picaxe to Picaxe Serial link

querth

New Member
Hello all,

I'm using a picaxe datalogger based on the datalogger kit in an electric race car for logging motor temperature and battery current draw. The unit is self contained with its own power supply.

We'd like to add car-to-pit telemetry so I've assembled two of the Pixaxe connect boards. I could just connect the current and temperature sensors to the Connect board and transmit the data directly back to the pits. However, some of the circuits we run at are too big for an XBee (or XBee pro's) range and so some data would be lost over the far side of the circuit. We also have two cars with their own dataloggers (identical) and I'd like to be able to move the Connect 'sender' unit from car to car as required.

Can I just connect a serial link between the two units? - digital in from one into an out on the other and visa versa - then use serin/serout commands to allow the Connect board to request data from the logger when in range of the pits. The two units are self contained with their own power supplies (3 x AA batteries) - will connecting them together with a common ground like this cause a problem? Apologies if this is a really daft question - I'm more programmer than electronics engineer!!

Geoff
 

moxhamj

New Member
Yes, you can just connect them together. Common ground will be fine. If you are running on batteries, that won't matter.

So you might end up with simple hardware with three wires, transmit, receive and ground.

The only catch is if you are sending data both ways. If a picaxe goes into a serin it will hang forever wating for data. With two picaxes it could be possible both go into serin and are both waiting for the other to speak first.

But if you are datalogging, the data might only be one way. The other wire could be used just to tell the datalogger to send all its data. eg

Base puts a wire high.
Datalogger checks that wire is high (maybe a pulldown for when not connected).
If wire is high, datalogger sends out all the data after a short delay (?10ms)
Meanwhile, base has gone into a serin and is ready to get all the data.
 

querth

New Member
Thank you. Advice heeded about avoiding deadlock. Do I need a 22k and pulldown resistor on the input of the Connect board - al la the picaxe download circuit?
 

moxhamj

New Member
Yes, a pulldown would be a good idea, as the input would be floating when disconnected. A series resistor probably isn't needed though unless you think it is likely there will be a short circuit somehow.
 

tiscando

Senior Member
Also, take a look at hsersetup (x1 and x2 pars only), in the automatic mode, it will recieve any data it recognises into it's scratchpad, and when it does, the hserflag (flag5) gets set to 1, and so you can have the setintflags %00100000,%00100000 that interrupts the picaxe program and reads the scratchpad via the 'get' command, and resets flag5 before returning. for other picaxes, a good way to interrupt the picaxe ready to recieve serial is e.g.

setint %00000010,%00000010

Code:
high 1     'transmit serial
pause 20 'try a higher value if the other picaxe doesn't recieve sufficient data.
serout 1,t[baudmode]_[clkfreq], ([variables/numbers - same number of bytes as how many variables are in the other picaxe's serin command])
pause 5
low 1
[code]

interrupt: 'recieve serial
serin 1,t[baudmode]_[clkfreq], [same number of variables as how many bytes transmitted from other picaxe]
pause 5
[code]
setint %00000010,%00000010
return
 
Last edited:
Top