I am currently trying to interface a Particle Boron with the DFRobot Tipping Bucket. This product’s wiki includes I2C and UART code and associated libraries which I have been using in Particle Workbench in VS Code. I have attempted to modify the arduino style code to match this IDE and have had no success of the Boron even initializing the rainfall sensor… it is as if it doesn’t “see” it. I have listed a few things I have tried in order.
1. I have directly copy and pasted the rainfall library and I2C code linked in the rainfall sensor's wiki.
2. I have edited portions of the code to align with Partice VS Code instead of using Arduino IDE. There has been no success with multiple edits. I keep recieving this error “Sensor Init Error!!”. This is true when I use UART too.
3. I moved forward with an even more simplified code to determine if these two electronics were even talking. No success.
4. I created a fresh project that simply scanned for an I2C connection from the Boron to Rainfall sensor which came up with nothing. It seems as if the boron does not even “see” the rainfall sensor after multiple attempts.
I will attach a wiring diagram of what I have done so far. In the diagram it shows I use 4.7 pull up resistor which I have tried, but I have also tried a 10K pull up resistor.
I am also working on determining if this could be a DFRobot rainfall sensor problem.
Lastly, and another intersting point, is that I attempted to use a ESP32-S3 with the same code and libraries addresses in the DFRobot product wiki and it still gave me the error “Sensor Init Error”. I have tried two different electronics and a variety of edits to the code and libraries with no success.
It should work. Your diagram for I2C looks correct. Verify that your wiring is correct and I2C mode is selected on the interface board. Then flash the I2C scanner firmware to your device to see if it can be see that way.
@rickkas7 I reverified my wiring and it matched the schematic. I ran the I2C scanner from Particle docs and see this in the serial monitor "Scanning… No I2C devices found".
@gusgonnet Thank you for pointing this out. Yes I do have the gravity switch set on I2C.
I have switched out Borons too just in case it was a one off error but keep getting the same errors. It seems like it must be a hardware issue based on all the things I have ruled out or just some off incapability with this rainfall sensor?
Yes, I have done some complete hardware changes a few times with no success. If this helps give a picture… I have a Boron on a breadboard and M-M wires connected from the Boron to the F side of the rainfall sensor wires (wires on the left of this image).
You said that you had another MCU (ESP32-S3). I would run the I2C scanner in it to see if it detects the sensor.
If it does not detect it, this is a bad sensor.
If it does detect it, I would switch the boron for another one (in case you had one, of course). One time I inadvertently burned the i2c on one device, still unsure how.
Alright I have tried with an Argon and still recieve the same issue. I have even tried to use an Arduino Uno which is recommended by DFRobot with no luck still. Based on all these attempts it seems right to assume it may be the rainfall sensor.
As a last attempt and on an MCU that you don’t care too much about, since it would be running a bit of a risk of damage, I would switch the sensor to UART mode via its switch and try the I2C scanner again.
Who knows? Maybe the switch is inverted or maybe the pcb is upside down.
But this is a risky move! I’m not 100% sure of the consequences…
The tipping bucket will have a reed switch. You can count the pulses directly with an interrupt on the Boron and skip the I2C & it’s hardware. That’s what I’ve done in the past, works fine with a 1-second debounce.
It seemed like adding this line off code was helpful but It is hard to say what the exact issue was. I did use the logHandler in other attempts with no results, nonetheless, specific to this chunk of code adding the logHandler helped.