I don’t know what the white box is in the top right of that one photo, but I’m assuming it’s an external power supply. I’m not sure why you are using that; the sensor definitely doesn’t need it and all 3 sensor wires are supposed to be connected directly to the Arduino board. As stated in several of my replies above, connect the sensor red wire to D7. Connect the sensor white wire to the ARDUINO’s 5V pin (also sometimes called Vcc). And connect the sensor bare wire to the ARDUINO’s ground pin. You don’t need an external power supply for any of this. You’re not getting any data because the Arduino board and external supply don’t share a common ground, so there’s no common reference between them so the Arduino is unable to measure anything on that red data wire because it’s all by itself as far as the Arduino can tell. What voltage were you putting on the white wire connected to the + terminal of that external supply?
Remove the supply completely and connect the sensor directly to Arduino board. Run the “simple_logger” example that’s included with the SDI12 library (changing the DATAPIN in line #37 from pin 9 to pin 7 if you want it to match the code above…). It’ll scan all of the channels and tell you if it sees a sensor and prints what channel it’s on and some basic info about it. If it’s not set to channel 1 or isn’t reading it at all, then you’ll need to keep troubleshooting before trying the code above. You can also use the “wildcard” example for just testing the sensor. Use the “address_change” example if you want to change the sensor address. You should be able to see if it’s all working correctly there too. If all of that looks good, then you can try the above code again, and making sure that you’re using the proper data pin in the DATAPIN declaration line each time. My example above is pin 7, but the library’s have a default of 9. Either one is fine, just be consistent and make sure you’ve got it hooked up right.