Can you help me? Raspberry Pi, Relay, Sonar

Can you help me whith the conections?

‘led1’: GPIO 20, ‘led2’: GPIO 27, ‘led3’: GPIO 22, ‘led4’: GPIO 5, ‘led5’: GPIO 6, ‘led6’: GPIO 13, ‘relay’: GPIO 21

Probably not without more information. With this we have no idea where led1-led6 are (uploading the sketch the .fzz file, upload is 7th icon from the left in the reply menu) would be a good start, as it would tell us where the LEDs are. The relay appears to be lacking a source of power for the light bulb. It is unclear how it is supposed to connect since there is no power source shown.


1 Like

(post deleted by author)

Yes that all appears to be correct (although the leds are led1 on the left then led10, 11 12 13 14 according to Fritzing and the relay connects to GPIO21. So far I am not seeing a problem here. If you hover the mouse over a pin on the RPI board it will tell you what pin number that is (snip and sketch won’t capture a screen shot for me because of how Frtizing displays it though.) To verify the connections and everything connected to that net will highlight in yellow like this:

if I move the wire off the pin, the end of the wire will still light yellow but the RPI connector will remain red indicating no connection (the one next to it circled in green is a correct connection.) You can also (and should!) switch to schematic view since if the connection is active it will appear in schematic and pcb views as rats nest lines.

In this case schematic view indicates problems. Both the relay part (I posted a corrected version for someone yesterday) and the Hc-04 part are incorrectly configured as indicated by the red rectangle around them. Note however there is no rats nest line from LED1’s anode to the RPI because there is no connection. The hc-sr04 in core parts on Fritzing 1.0.3 (the current version) appears to be correct so I expect you are using an older Fritzing version and either need to find a working hc-sr04 part on the net or upgrade to 1.0.3. Hope this helps (because I am still unclear on what the question was …)


Here is a replacement HC-SR04 part that should work better (exported from 1.0.3.) You need to do a delete minus of the current part then load this one and drag the wires (in all 3 views) on to the new part to connect them.

HC-SR04 Ultrasonic Distance Sensor.fzpz (41.7 KB)

as noted the corrected relay part is in a post from the last few days.