Connection is good, ESP reacts to HA switch, so I guess you are close. Two things
Did you check that your SDI-12 sensor has adress ‘1’ and is actually working?
I think you need to feed the modbus with ASCII? Try data: '49 77 33' for your read sensor
Edit: You might need to play around with the ASCII formatting: Convert a String to ASCII Code - Online String Tools
I haven’t looked into the serial connection of the Liudr board for compatibility (maybe Liudr has some documentation about this on his website?)
yes i have confirmed the sensor is working and i have changed the sensor address to 1. i used an android app “usb serial terminal” connected via the usb.
i tried the ‘49 77 33’, no luck, logs look the same as the ones i posted above.
liudr sell a version of his board without the usb port and chip (so only has the serial port for coms) called the SDI-12 TTL adapter, so i presume compatibility shouldnt be an issue?.
I guess that TTL serial is also on your SDI-12 board? Maybe ask Liudr what protocol is used for TTL coms, he seems responsive to these kind of questions.
ok quick update, i have been in contact with dr liu about using the serial connectror on his board as opposed to the usb and it turns out there are a couple of extra steps to hopefully get this to work.
first there is a couple of pads that need bridgeing on the pcb labled “FT_RST” to disable the usb serial port so the uart serial port can be used instead.
next the serial connection on the liudr board has both 3.3v tx and 5v tx pins, the esp32 wants 3.3v but on the usb version of the liudr board the 3.3v tx is not fully populated with the required components it is missing 2 10k resistors, so you need to add 2 resistors or use a seperate logic level converter and use the 5v tx on the uart serial port.
i have went with the level convertor and i am now pretty confident that everything is wired correctly, i have not had chance to try it out yet but fingers crossed this should work.
starting to get somewhere, using the code below i have managed to get two basic switches on the dashboard sending the commands 1M! and 1D0! and finally have a response from the sensor!!!.
does everthing look correct?.
any pointers on how i go about seperating out the different data from the sensor and how do i save the data to a csv file to log?.
Looking good @sar1! Can you find the ‘tdr_wc_ec_uart’ sensor in home assistant? And does it’s value update with lines like ‘1+0.0+23.0+1.1+0+0’? Than you can point my code towards that sensor. If you go into developer tools in home assistant, and check your entities you should find the full name of your sensor. Probably something like ‘sensor.tdr_wc_ec_uart’
If you look back at my first post, at the configuration.yaml; you can edit the template and use the rest of my code.
So change sensor.serial_sensor to your SDI-12 output sensor here:
This particular code looks for a ‘1’ inside the SDI-12 raw output from your ESP, then creates another sensor named ‘Sensor Adress 1’ that will simply display the sensor address, since this is the first thing to be extracted from the raw SDI-12 string. Later I repeat these steps with volumetric water, temperature and EC, I basically extract the value between the + signs in the raw string, and convert these to new home assistant sensors seperately. So you do have to change the same sensor for volumetric water content, temperature or which ever value your sensor puts in the SDI-12 string.
Later I combine all the newly created sensors in a home assistant automation, and group them in a message to log them. You can copy the automation and see if it works for you.
hey rik, i had put this on the back burner for a month or two but now i have found some time i am back on it.
i havent done anymore since your last post, only installing all the components in box ready for use.
i did add a 2 channel relay board to control 2 24v irrigation valves and have managed to add the code to get 2 bottons on the home assistant dashboard and they control the valves fine.
once i had everything wired up in the new box i checked the logs from the esp32 and its now no longer displaying the readings from the acclima sensor correctly anymore?, the data is still returned sometimes but now comes in with more odd data?.
i have included some pics of the new logs so you can compare to the old ones, i havent changed any code since our last conversation when it was working correctly?, only adding a little bit of code for gpio pins for the valve relays?.
also in your last post you asked if the ‘tdr_wc_ec_uart’ sensor shows up in home assistant/developertools/entities, the answer is no it does not show up?.
any light you could shed on this would be very much appriciated.
I have an Sdi12 Sk16 from Dr Lui And is this the code i would put in to make my teros 12 get readings? I am really new to all of this and just need some help.
i have the device hooked into the sdi12 usb adapter and thats plugged into my rpi400. I just need help converting it to ec, moisture %, and temp and then that data somehow being read in HA.
No problem @sar1, excuse me for replying a bit late, busy times are behind me
For your text sensor to show on home assistant, i think you have to add a name to it, I’m also not sure if ‘ID’ works, since that one is not listed (anymore) in the docs:
For your odd data, I think one of your pins is interfering with your UART pins, maybe you could try commenting out your relay switches in de code first and see what happens. Other than that, I think you might need to solder these off the ESP and test with a breadboard if other pins have more succes
hi @Potterstraat, no excuse needed im just glad you replied.
i did notice i had not named my text sensor, i will try it today to see if i can get it to show in home assistant.
as for the odd data i have already tried deleting the code for the relay pins and it made no difference, i also tried deleting the relay code and unsoldering the relay wires from the esp32 and unplugging the powerpacks for the relay board and the 24v valves and no change?.
i also checked with a magnifying glass for stray wire strands or a solder ball causing an issue but couldnt see anything?.
and of course i have checked the wiring just to make sure i have not made a silly mistake but it all looks correct.
i agree it does look like maybe some sort of interference in the data but not sure why?.
Very recognizable, and it is indeed strange that it worked before. Now the UART log probably shows a lot of jibberish because it outputs about everything going on in that ESP I guess?
I have one UART device in my Home Assistant setup (an ESP connected to an arduino board), and I also stole an include from somewhere to enable UART coms on the ESP:
Reading that much inconsistency almost makes me think something bigger is going on, checked your power supply already I suppose? Try hooking up the Liudr board on a seperate power supply (USB) maybe?
I purchased the sdi12 sk16 adapter and i’m using a teros12 meter attached to it. How will i get this to work with home assistant and be able to read vwc, ec and temp. right now im using the python script that came dr lui recommends but its not giving me the data in those 3 outputs. just the raw data.