+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 21 to 33 of 33

Thread: Can anyone Help With Atlas PH stamp on propeller

  1. #21

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    correct, but all the digit's of the temperture (ec 27.5 ) must be send as (byte)asci so for 27.5 ill have to send 50, 55,46,53
    after that I need to send a <cr> so 13
    so the total sting is
    50,55,46,53,13,0

    that's somthing diferent flom that floattostring object or Am i wrong ???

  2. #22

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Do you need to send the string "50, 55, 46, 53, 13", or do you need to send those bytes in sequence, because that is what FloatToSTring will do.

  3. #23

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Code:
    DAT
    
    readCmd       byte "r", 13, 0
    in place of the R . I have to send the temp data

  4. #24

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    So, yes, send the result of FloatToString followed by char 13.

  5. #25

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    "50, 55, 46, 53, 13"
    those are the byte's that need to be send

    can't find a way out

  6. #26

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    The following example - when calling display(temperature) - will basically send out the ASCII characters for "2"(50), "5"(53), "."(46) and "7"(55) followed by a CR(13). It's really not that hard
    Code:
    CON
      _clkmode = XTAL1|PLL16X
      _xinfreq = 5_000_000
    
    CON
      temperature = 25.7
      
    OBJ
      serial: "FullDuplexSerial"
          fs: "FloatString"
          
    PUB null
    
      serial.start(31, 30, %0000, 115200)
      waitcnt(clkfreq*3 + cnt)
      serial.tx(0)
    
      display(PI)
      display(temperature)
    
    PRI display(fpn)
    
      serial.str(fs.FloatToString(fpn))
      serial.tx(13)

  7. #27

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    any suggestions on code examples on how to do that ?

  8. #28

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    I understand what you mean, tring to figure out how

  9. #29

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Quote Originally Posted by Igor_Rast View Post
    Code:
    PUB  gg 
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 0
         byte[@tt][0]:=48
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 1
         byte[@tt][0]:=49 
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 2
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 3
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 4
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 5
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 6
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 7
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 8
         byte[@tt][0]:=50
      if f.FTrunc(f.fmul(temp1,10.0))/100 == 9
         byte[@tt][0]:=50 
        
      return
    Did you notice that your ascii values are 48, 49, 50, 50, 50, 50, 50... ?

    Anyway,
    Code:
    Com.Str(fp.FloatToString(floating_value_of_temperature))
    Com.Char(13)

  10. #30

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    hahah, Yea I noticed it a sec later, forgot to change it in the post.
    but Im verry happy to say
    that your the man of the night
    it work like well
    now it's like this

    with this code I get a temperture compensated reading on my lcd , using a ph stamp of atlas and a ds1820 temp sensor
    also I made some calc to get the dierance between the actual Ph and a target Ph later to set

    THanks allot, Hope the code will help someone one the milestone

    Code:
    CON
    
       _clkmode = xtal1 + pll16x
       _xinfreq = 5_000_000
    
    
      
      RS = 0                         {lcd control}
      RW = 1                         {lcd control}
      E  = 2                         {lcd control}
      DBLow  = 3                      {lcd control}
      DBHigh = 6                      {lcd control}
    
      CR  = 13
      LF  = 10
      PSTClearScreen = 16
    
      tempsensor = 14
    
    
      
      _pHTx = 7                  ' Connected to Rx on pH Stamp
      _pHRx = 8                  ' Connected to Tx on pH Stamp
      _DebugTxPin = 30
      _DebugRxPin = 31
     
      _PhBaud = 38400
      _DebugBaud = 57600
      _BufferSize = 50
    
      Target_PH     = 7.1
                                       
    
      SKIP_ROM          = $CC                               ' 1-wire commands
      READ_SCRATCHPAD   = $BE
      CONVERT_T         = $44
    
      CLS               = $00                               ' clear screen
      HOME              = $01                               ' home
                                   ' carriage return
      DEG               = $B0                               ' degree symbol
       #8, BKSP, TAB
    VAR
    
      byte messageBuffer[_BufferSize]
     long tempc  ,temp1,temp   ,diference,delta    ,ph     ,ph1
     
    OBJ
    
      Com : "Parallax Serial Terminal"                 ' uses two cog
      ow            : "OneWire"
       fp            : "FloatString"
      f             : "FloatMath"   
     
      LCD : "LCD_20x4"
     
      
    PUB Main | localIndex, localAttmpts
    
      ow.start(tempsensor)
      
      LCD.Init( E, RS, RW, DBHigh, DBLow )                            {LCD init}
      LCD.usDelay( 5_000 )                                            {LCD init}
      LCD.Clear
          
      Com.StartRxTx(_pHRx, _pHTx, 0, _pHBaud)
      waitcnt(clkfreq / 4 + cnt)
    
      Com.str(@endCmd)
      
      repeat
         
        getTemperature                            {get the temperture}
    
        LCD.RawSetPos( $00 )                              {set lcd position}  
        LCD.PrintStr( String("Temperture"))
        LCD.RawSetPos( $0B )                               {set lcd position}
        LCD.PrintStr(fp.FloatToFormat(temp1, 4, 1))        {float to sting}
        LCD.PrintStr( string(" C" ))                       {display C after temp}
            
        Com.str(fp.floattostring(temp1))                                      {Ask for Reading/ sending temp  Thanks "Circuitsoft"}
        com.char(13)
        Com.StrIn(@messageBuffer)                         {Getting reading Back/ readin in messagebuffer}
                            
            
        ph1:=fp.StringToFloat(@messageBuffer)                     {Ph1 = float PH to calculate with} 
        delta := f.FSub(Target_Ph,ph1 )                           {diference = target_ph - PH1  }
    
        LCD.RawSetPos( $40 )                              {set lcd position}  
        LCD.PrintStr( String("Target Ph   7.1 "))
        
        
         LCD.RawSetPos( $14 )                              {set lcd position}  
         LCD.PrintStr( String("Actual Ph"))
         LCD.RawSetPos( $20 )                              { diplay Actual PH on lcd }        
         LCD.PrintStr( @messagebuffer)
          
                     
        LCD.RawSetPos( $54 )                              {set lcd position}  
        LCD.PrintStr( String("Diference"))            
        LCD.RawSetPos( $60 )                                             
        LCD.PrintStr( fp.FloatToFormat(delta, 4, 2))      { display diference from ph and target_ph  }
            
        bytefill(@messageBuffer, 0, _BufferSize)
        waitcnt(clkfreq/2  + cnt)
     
    
    DAT
    
    endCmd        byte "E", 13, 0
    readCmd       byte "r", 13, 0
    continuousCmd byte "C", 13, 0
    tt            byte  "2","5",".","5",13,0
    temp2         byte
    PUB getTemperature 
      ow.reset                                              ' send convert temperature command
      ow.writeByte(SKIP_ROM)
      ow.writeByte(CONVERT_T)
    
      repeat                                                ' wait for conversion
        waitcnt(cnt+clkfreq/1000*25)
        if ow.readBits(1)
          quit
    
      ow.reset                                              ' read DS1822 scratchpad
      ow.writeByte(SKIP_ROM)
      ow.writeByte(READ_SCRATCHPAD)
      temp := ow.readByte + ow.readByte << 8                ' read temperature
      temp1 := F.FDiv(F.FFloat(temp), 16.0)                  ' convert to floating point

  11. #31

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Does your temperature sensor return a floating point value?

    It looks like the only time you're using floating point math is to multiply and divide (which work fine using integer math). I still think it would be easier to convert the temperature to a pseudo real number (by multiplying it by a set amount and then use the "FRound" or "FTrunc" method to convert it to an integer) and then do the rest of the calculations in pseudo real integers.

    You can then use the "DecPoint" method I linked to, to send the number to the pH Stamp.

    If you stay with floating point, use the method kuroneko showed you.

  12. #32

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    Igor,

    How is your project progressing?

    I purchased one of these pH Stamps myself. So far I'm pretty impressed by it.

    I find the device sends more than just pH values when I send the read "r" command. It output the pH and also the words "base:" and "acid:" followed by a one to three digit number. I'm pretty sure the numbers are the millivolt values. A number following the word "acid:" represents a positive millivolt value while a number after the word "base:" represents a negative millivolt value.

    I'm very please to see these millivolt readings. It means it will be possible to use the Propeller to set additional calibration points.

    I was very surprised recently to see how big a difference calibrating a pH meter with 1.68 pH buffer and 4.01 pH buffer instead of just 7.00 and 4.01 buffers when measuring the pH 2.00. Using just 7 and 4 buffers in the calibration caused errors as large as 0.2.

    My plan is to use a Nordic transceiver to send the pH values wirelessly to my other lab data logging equipment.

    I thought I'd let you know I was working on a similar project in case you'd like share notes.

    I'll have to see if I have a DS1820 sensor so I can add temperature compensation with it. If I don't use a DS1820, I'll likely use some other temperature sensor.

  13. #33

    Default Re: Can anyone Help With Atlas PH stamp on propeller

    He Duane , Sorry for my O so late reply . I had been busy with all kind of stuff

    about the ph stamp, when i was moving about 3 months ago , i accidently stepped on the ph probe. and broke it of course. That was for the time the end of the ph for a moment .
    I did manage to get it working , reading the ph of a watertank , and it did controll a peristaltic pump to adjust the ph , unfortunately for the program also , I had some trouble getting the ukhash virus off my computer with result losing every single file I had , So i had to start all over again.

    I didn do anything with the ph & ec stamp anymore, but the day I continue with them is getting close again i think . the stamps did survive :p
    anyway i thout i tell you

    I am working on another controller now , monitoring temperture and humidity with a sensiron sht-11 sensor
    processing these showing the values on a small screen , a menu interface
    and a wiznet w5200 module connected , trying to get a fully web controlable interface , with loginscreen , and dhcp so it will auto set ip enso ,.
    id say take a look at my thread , Mike G giving me some great help over ther.

    share notes always sounds good to me, ill definitly be intrested to continue the ph& ec monitor
    its like the next step to add that to the current controller , giving you the HTML5 web interface , would be nice i think

+ Reply to Thread

Similar Threads

  1. Stamp --> Propeller
    By worthyamherst in forum Propeller 1 Multicore Microcontroller
    Replies: 9
    Last Post: 07-07-2011, 01:43 PM
  2. Propeller or Stamp?
    By Dwayne Dibbley in forum General Discussion
    Replies: 8
    Last Post: 06-23-2011, 09:18 PM
  3. propeller or Stamp
    By whiteoxe in forum General Discussion
    Replies: 2
    Last Post: 09-06-2010, 05:45 PM
  4. Propeller vs Stamp
    By Dave Adams in forum Propeller 1 Multicore Microcontroller
    Replies: 3
    Last Post: 03-08-2008, 04:40 AM
  5. Atlas Component Analyser?
    By Pezi_Pink! in forum General Discussion
    Replies: 0
    Last Post: 04-14-2006, 05:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts