I'm new to Arduino, electronics, and this forum.

I have made up a little project that connects an HC-SR04 ultrasonic range detector, and displays the distance on a 4 digit, 7 segment LED display.

When I have it plugged into my laptop for power, it runs beautifully on an Uno board.

But I want to mount all this in a Nerf gun (Nerf N-Strike Elite Firestrike) using a Nano board.

The Nerf gun has a built in "laser" (red light) that is powered by 2 x AAA batteries, which makes 3 V, I think. I want to rig this up so that pulling the laser/light trigger also triggers the range detector and display.

I want to run the range sensor and the display off the Nerf guns batteries, but they both use 5 V. Is there a way to do this? Or do I need a separate 5 V power supply?

  • I cannot answer the question as asked. I don't know of a way to convert 3V to 5V. Arduinos run better at 9V anyway. You are probably going to want 9V battery for an Arduino Nano to mount in the Nerf gun. Have you considered this?
    – SDsolar
    Jul 24 '17 at 2:45
  • Yes, I have considered a seperate power supply. Maybe a 9v battery powering the nano is the way to go.
    – nedlud
    Jul 24 '17 at 4:17

You may want to use a boost converter which is a device that can step up voltage.

You can get them from eBay for around $US 2.

As Chris Stratton pointed out in a comment, the boost converter may run your batteries down quite quickly. Let's say you need 200 mA for your Uno, sensor and LEDs. At 5V power that is 1W of power (0.200 * 5).

However to get 1W from 3V you would consume 333 mA (0.333 * 3). Then take into account that the converters are not completely efficient. Let's say the converter has 90% efficiency. Then you need to multiply the current by the inverse of the efficiency, that is: 0.333 mA / 0.9 = 0.37 mA.

Another factor is the battery type. If you use NiCad batteries their nominal voltage is closer to 1.2V than 1.5V, especially after you have been using them for a bit. Ditto for NiMh batteries.

Reworking the above for 2 * 1.2V (2.4V) we see that the current will be:

1W / 2.4V = 0.4167A
0.4167A / 0.9 = 0.463A (allowing for 90% efficiency)

Now it potentially draws close to half an amp when active. Your batteries might not be able to handle that for long.

  • 1
    This is possibly, a solution, but may place a lot of load on the little AAA batteries, as the current drawn at the input voltage is the current needed at the output voltage multiplied by the ratio and the reciprocal of the conversion inefficiency. Jul 23 '17 at 22:42
  • 1
    Indeed. Still, to meet the requirements of the question it could work (for a while). I've edited the question to do some maths for the current draw.
    – Nick Gammon
    Jul 23 '17 at 23:29
  • All this math makes my poor head hurt.
    – nedlud
    Jul 24 '17 at 4:08

Just to suggest an alternative, and more energy efficient, solution...

There appear to be newer versions of the HC-SR04 on the market that support 3.3V, such as the HC-SR04 v2 - Low Cost Ultrasonic Sensor (3V to 5V Supply).

So you could use an Arduino Pro Mini designed to run at 3V in conjunction with the 3.3 V HC-SR04, and run it straight off your nerf gun's power supply.

However, it might be worth taking these new versions with a pinch of salt, as modules seem to vary from one to another, see Re: Do HC-SR04 5V rangefinder sensors work in 3V battery mode?

I have a MKRFOX1200 working with HC-SR04 and it works fine. It is stated to work only at 5v but its fine with 3V. But I have another one (SF-SR02) with a higher range (6meters) and this one doesnt get any further than 1 or 2 meters under 3V. If I use the 5V for VCC while running on USB, it reaches full range. Digital inputs seem to be more tolerant than they state for 5V signals.. (although I'm not advising to do so!!)

An extremely useful comparison of these modules (the first generation) running at both 3.3 and 5 V can be seen here, Re: Ultra cheap ultrasonics, and a bit of a challenge:


HC-SR04 running at 3V3


HC-SR04 running at 5 V

Notwithstanding, the newer versions of the HC-SR04 may have an improved response.


Arduino nano also have 5v-3.3v voltage regulator so you can power all this with only one power supply (power your arduino nano with 6x AAA batteries) and then just connect your nerf gun power with arduino nano 3.3v pin, it will work just fine............ :)

  • I like this option. Rather that running the Arduino off the guns power, run the gun off the Arduino's power. Still means I need to put in more batteries. I was hoping to fit everything inside the Nerf gun, but that might not be possible. Or I just buy a bigger Nerf gun.
    – nedlud
    Jul 24 '17 at 4:09
  • 1
    This is a very good solution. And yes, they make bigger Nerf guns. But also keep in mind that the Nerf gun is going to shoot much further than the ultrasonic sensor can measure. While this is an interesting project, it may not turn out to be useful.
    – SDsolar
    Jul 24 '17 at 5:52

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.