1

I've finished testing and mounting my hc-sr04 and sg90 and now i have to connect everything, but have doubts and questions. Here are the diagrams that show what I am thinking to do:
This one shows how I would like to connect either the SG90 or the HC-SR04 enter image description here
This one shows how I would like to connect both the SG90 and HC-SR04 to the L298N enter image description here
The L298N is powered by 2x3.7V 18650 batteries(chinese brand) and it drives 2xDC wheels.
I would like to know if:

  • the wiring in both cases is correct?
  • there is any benefit from one of them over the other?
  • there are any risks I should consider when connecting SG90, HC-SR04 or other similar +5V devices to the L298N?
  • I connect both devices to the L298N can I have som problems like heating or malfunctioning of the L298N?
  • using a Power bank(2600/5000mHa) to power the Pi which one will consume more power, e.g. will one of them cause my battery the exhaust faster? Given the fact that the HC-SR04 will be used more often in order to detect obstacles.
    There is also a Raspberry camera connected to the Pi camera slot.
    Thanks in advance
0

Both sets of wiring look okay as far as I can tell with one minor proviso.

It is safer to use a voltage divider (pair of resistors) on the HC-SR04 echo line to cut the voltage from 5V to 3V3. A single resistor will give some protection if >5k or so, but a proper divide is better.

I can't remember how much 5V power the 5V on-board regulator of the common L298N motor driver boards can supply. It'll probably be enough for a small 9g servo.

  • I have a 1K resistor between Echo and IN pin on the Pi. You say that I need >5K, so I need to look for another resistor?(I do not have a spare one) From your answer I assume that I cannot connect both the HC-SR04 and SG90 to the +5V of the L298N? – archer66 Aug 20 '15 at 18:53
  • According to my limited knowledge the current flow will be (5V-3.3V)/1000 amps with a 1k resistor, or 1.7 mA. You should be aiming for less then 0.5 mA. See mosaic-industries.com/embedded-systems/microcontroller-projects/… – joan Aug 20 '15 at 18:59
  • Ok, that makes things more clear for me. Can I assume that this power devider circuit will be safe modmypi.com/blog/… ? – archer66 Aug 20 '15 at 19:52
  • @archer66 As far as I am aware the pair of resistors to form a voltage divider is by far the most common solution to drop 5V to 3.3V for the Pi. It is perfectly safe. – joan Aug 20 '15 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.