Hallo zusammen, ich habe ein sehr seltsames Phänomen, welches ich mir mit meinen mittelprächtigen Elektronik-Kenntnissen nicht erklären kann.
Ich habe mit Hilfe eines Arduino Nano ESP 32 eines LCD-Displays, 2er Taster und einer Ultraschallsensors (JSN-SR04T) einen Zisternen-Sensor gebaut, der die Daten regelmäßig ausliest und via WIFI und MQTT an HomeAssistant sendet. Zunächst habe ich das ganze auf einem Breadboard aufgebaut und dann, nachdem alles funktionierte fliegend verkabelt (verlötet). Alles funktioniert prima. Dann habe ich (der Ordnung halber) eine Platine entworfen, welche das Chaos der fliegenden Verkabelung beseitigen sollte. Auf die Platine habe ich Buchsenleisten gelötet, so dass ich den Arduino und die kleine Sensorplatine des Ultraschallsensors aufstecken kann.
Nach dem Aufstecken der Komponenten funktionierte das Ganze leider nicht mehr. Nach langer Fehlersuche habe ich die Sensorplatine mal abgezogen und die Pins (GND, Trigger, Echo und 5V) mit Breadboardkabeln mit der Platine verbunden (1:1, also unvertauscht einfach nur verlängert)... und plötzlich funktioniert es o.O.
Bei aufgesteckter Sensorplatine kommt scheinbar über den Echo-Pin kein Signal zurück. Lese ich den EchoPin mit pulseIn() aus, kommt als Dauer immer 0 zurück.
Zur Erklärung: der Sensor funktioniert normaler Weise so: Über den Echo Pin wird für ein paar Millisekunden ein HIGH-Signal an den Sensor geschickt. Das Zurückfallen auf LOW startet einen kurzen 40 kHz Impuls über den Sensorkopf und der Echo Pin sollte in diesem Moment auf HIGH gehen. Wenn das Echo-Signal vom Lesekopf aufgefangen wird, geht der ECHO Pin auf Low und über pulseIn() kann die Dauer ausgelesen werden, woraus sich der Abstand mit Hilfe der Schallgeschwindigkeit errechnen lässt.
Ich dachte mir, dass es vielleicht die Pins in der Steckverbindung beim direkten Aufstecken keinen Kontakt haben. Wenn ich die Sensorplatine aber aufstecke und durchmesse, haben alle Pins Kontakt und es gibt auch keinen Kurzschluss. Zur Info: der Trigger ist an GPIO21 und der Echo Pin an GPIO18 des Arduino angeschlossen.
Da das Signal, welches an die Sensorplatine geschickt wird und am anderen Pin von Ihr zurückkommt einfach nur ein HIGH/LOW ohne Frequenz ist, würde ich mal Impedanzprobleme ausschließen.
Eine weitere Beobachtung, die ich gemacht habe: Wenn ich das Sensorboard mit den "Verlängerungskabeln" anschließe, so dass es funktioniert und ich mit der einen Seite des Messgeräts den GPIO21 oder den GPIO18 berühre, wird auch keine Messung durchgeführt (Erdungsproblem?).
Als Stromquelle habe ich den USB-Port meines Rechners, eine Powerbank und verschiedene Netzteile ausprobiert.
Ich bin mit meinen bescheidenen Elektronikkenntnissen am Ende. Hat von Euch evtl. jemand eine Idee?
Lieben Dank im Voraus.
Hello everyone, I have a very strange phenomenon which I cannot explain with my mediocre knowledge of electronics.
With the help of an Arduino Nano ESP 32, an LCD display, 2 buttons and an ultrasonic sensor (JSN-SR04T), I have built a cistern sensor that regularly reads out the data and sends it to HomeAssistant via WIFI and MQTT. First I built the whole thing on a breadboard and then, after everything worked, I wired it up (soldered) on the fly. Everything works fine. Then I designed a circuit board (for the sake of order) to eliminate the chaos of the flying wiring. I soldered female connectors to the board so that I could plug in the Arduino and the small sensor board of the ultrasonic sensor.
Unfortunately, after plugging in the components, the whole thing stopped working. After a lot of troubleshooting, I unplugged the sensor board and connected the pins (GND, trigger, echo and 5V) to the board with breadboard cables (1:1, i.e. simply extended without swapping them)... and suddenly it worked OK.
With the sensor board plugged in, apparently no signal comes back via the echo pin. If I read the echo pin with pulseIn(), the duration returned is always 0.
To explain: the sensor normally works like this: A HIGH signal is sent to the sensor via the echo pin for a few milliseconds. Falling back to LOW starts a short 40 kHz pulse via the sensor head and the echo pin should go HIGH at this moment. When the echo signal is picked up by the read head and ends, the ECHO pin goes low and the duration can be read out via pulseIn(), from which the distance can be calculated using the speed of sound.
I thought that perhaps the pins in the plug connection were not making contact when plugged in directly. However, when the sensor board is plugged in and measured, all pins make contact and there is no short circuit. For your information: the trigger is connected to GPIO21 and the echo pin to GPIO18 of the Arduino.
Since the signal that is sent to the sensor board and comes back from it on the other pin is simply a HIGH/LOW without frequency, I would rule out impedance problems.
Another observation I have made: If I connect the sensor board with the "extension cables" so that it works and I touch the GPIO21 or GPIO18 with one side of the meter, no measurement is taken either (grounding problem?).
I have tried the USB port of my computer, a power bank and various power supplies as a power source.
I am at the end of my rope with my modest knowledge of electronics. Do any of you have any ideas?
Many thanks in advance.