Atlas PH stamp

rjconway

New Member
Hi was looking at the feasibility to communicate to a small pH stamp and send the value to an LCD. My biggest concern is the fact the baud is fixed at 38400 and not quite sure how to handle the response which has a value including decimal and a CR


Details from http://atlas-scientific.com/_files/pH_Circuit_3.0.pdf

The baud rate is: 38400, 8 bits, no parity, with one stop bit

The pH-Stamp will operate in continuous mode and deliver a pH reading
every 262 milliseconds (262 milliseconds with the LEDs off) until the “e” command is transmitted.

Full proper syntax: C<CR> There is no ASCII response to this instruction.

* (LED&#8217;s on the pH-Stamp off will respond every 462 milliseconds)
XX.XX<CR> (262 milliseconds)
XX.XX<CR> (524 milliseconds)
XX.XX<CR> (786 milliseconds)
XX.XX<CR> (n+ 264 Seconds)

Code:
'PICAXE 18M2

'PIN 10  B.4    Transmit to  Atlas pH
'PIN 11  B.5    Recieve from Atlas pH
'PIN 12  B.6    LCD Transmit

main:
 setfreq m32;
 serout B.4,T38400_32,("C<CR>") 'send character c to Atlas Stamp
 pause 500;
 
ATLAS_READ:
 setfreq m32;
 pause 100;
 serin  B.5,T38400_32, b1;    'read return data into variable b1
 setfreq m8;
 serout B.6, T2400_8, ("pH Value is" #b1);  'write to LCD
 pause 2000;
goto ATLAS_READ;
I am not sure how to handle the decimal place or if I have the correct syntax. Any suggestions appreciated.

Rob
 

nick12ab

Senior Member
Full proper syntax: C<CR> There is no ASCII response to this instruction....
serout B.4,T38400_32,("C<CR>") 'send character c to Atlas Stamp
When <CR> is specified in a string that means send the ASCII character<CR> not the characters <,C,R,>. Use serout... ("C",CR)

I am not sure how to handle the decimal place or if I have the correct syntax. Any suggestions appreciated.
As PICAXE cannot handle decimals, simply ignore the decimal point. When showing data on the LCD, you can then splice it back in. You can use '#b0,b1,#b1' when receiving the decimal value and in variable b0 you will get the number before the decimal point and b1 will have the number after the decimal point assuming that the numbers are sent in ASCII
 

hippy

Ex-Staff (retired)
It looks to be possible and the best way to handle it is probably to look for the <CR> terminating the previous reading then read the five characters of "XX.XX" data ...

SerIn B.5, T38400_32, ( CR ), b1, b2, b3, b4, b5
SerTxd( "Reading = ", b1,b3,b3,b4,b5, CR, LF )

The b1-b5 data can then be processed and displayed. If anything less than 5 characters are sent that can also be catered for; the datasheet suggests five characters are always sent, but it could possibly be 00.00 is sent as "0.0<CR>", 13.90 is sent as "13.9<CR>" etc - testing it will reveal what reality is.

Alternatively, the following may work as nick12ab suggests ...

SerIn B.5, T38400_32, #b1, b2, #b2
SerTxd( "Reading = ", #b1, "." )
If b2 < 10 Then : SerTxd( "0" ) : End If
SerTxd( #b2, CR, LF )

38400 baud is quite fast and the data may be sent back-to-back. If that's too fast for a PICAXE to handle with SERIN it may require using a PICAXE X2 and high-speed background receive.
 

rjconway

New Member
Thanks hippy and nick
That all makes sense. I get a unit in the next few days so will report back my findings. I eventually want 1 x ds18b20, ph and ORP unit connected to a single picaxe reporting values to an LCD.
 
Top