Sr04 not working on nano lot 33

Hello, im trying to use a sr04 distance sensor with my nano iot 33, and it simply just outputs 0cm every time. I know that the sensor works and that the pins are in the correct placement because when I replaced the bot 33 with a normal nano and uploaded the code the sensor worked perfectly. I am just using the example sketch provided with sr04 library

Answer: thanks to the help, I've solved it. What you need to do is solder the two pads on the underside of iot 33 on the vusb and add 2 10k resisters in series from the echo pin to the pin you want to use for the echo so that it brings the 5v logic down to 2.5v.

Maybe because the run-of-the-mill HC-SR04 should be fed 5v on the Vcc pin and you are giving it 3.3v? If used with a 3.3v microcontroller that does not have 5v-tolerant inputs (like yours), then the echo output needs to be level-shifted, such as by the simple approach mentioned here... using a voltage divider with two equal value resistors: HC-SR04 Ultrasonic Sonar Distance Sensor + 2 x 10K resistors : ID 3942 : $3.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Can't you use the VUSB pin for a 5v output on the iot 33?

What does your voltmeter say?

Nevermind im an idiot i figured out what you meant

When I used the voltage divider method it still doesn't work, also I don't have a voltmeter

If you are feeding 5v to the HC-SR04 and hadn't been using level shifting on the echo pin, you may have killed the Nano's pin. Maybe try another pin.

I don't have a Nano IOT 33, so I'm not sure about VUSB. What does the Nano IOT 33 datasheet say about using VUSB? I seem to remember seeing something about "no connection" unless a jumper is closed somewhere......

Also, in lieu of a voltmeter, you could try lighting an LED with VUSB (and current-limiting resistor).

So apparently I have to solder two pads under the 5v pin for it to work, which is a relief that I haven't been damaging the board. Also thanks for your help! Ill solder it later and let you know how it goes

Ok, hope it works. BTW, you really should get a digital multimeter, if you plan to do anything more than this project. Even a cheap one ($10 or $15) is better than nothing.

1 Like

It works!

:+1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.