Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Reply To: SDI-12 Slave

Home Forums Other Data Loggers SDI-12 Slave Reply To: SDI-12 Slave

#17853
neilh20
Participant

    Hi @dani68k, welcome to EnviroDIY.

    I’ve not got any experience on the ATmega32u4, and as a small AVR processor I would think you would need to customize your development for it. SDI-12 bit banging is very sensitive (unrelaible) if the timing isn’t configured right. Possibly using the USART would be better for timeing, but configuring that is another story. Also needs compute the CRC in the allocated time.

     

    My approach would be to separate the development in to two parts  divide the problem into smaller testable parts – one proving the SDI-12 protocol/ response and the other reading the sensor over I2C.

    Say every time there is SDI12 request – after any response to the host, flash the led for a correctly decoded CRC and a different sequence for failed CRC  – that way you know if the basic request msg was received OK.

    Then for successful request return an incrementing number, that way you can see that all the protocol is working, and the response CRC is being correctly calculated.

    Then separately, set up program so that say every 10seconds it reads the PH sensor, computes the units correctly and displays it with print the basic format you want to send as well as human readable format.

    Of course with realtime protocols like SDI12, and reading a sensor, prints do impact the real-time nature and may cause realtime bugs just using them. Having the USB interface does allow prints to come out, but also implies you need to understand how the queue is maintained inside the 32u4

    Unfortunately, its easy for many things to go wrong, and sometimes it takes focused analysis on the data flow to see the way it might work, and then tweak the program to work that way.

    When asking for help, you may want to be explicit as to  which library’s/systems  you are using, devices you are using and do all the work for any reader with links.

     

    good luck with it