93Views18Replies

Author Options:

Help needed circuit components with different voltage Answered

Hey,

I have a circuit with different voltage components. How would I make all the components run on one battery?

Discussions

0
user
dudes

2 years ago

I'd certainly be willing to help, but I need more details. What circuit(s)? What components? What battery? That sort of thing.

Well I actually don't have it yet, but I was thinking of an arduino micro-controller. An infrared LED a normal LED a solanoid. I think that's it. I wouldn't know wich battery is the most efficient but I don't want them all running in diffirent batteries.

Ok, first, the Arduino; If it's an Uno, Nano, Pro, Pro mini, Mega, Leonardo, or Micro, it has a built in voltage regulator, so any of those will work with anything from 7-15 volt.

Second, the LEDs, both of those will work with any voltage, if the right resistor is used.

Third, the solenoid; that;s a little trickier. Have you chosen a specific solenoid to use? If so, what voltage does it require? If you just need a general solenoid, try to find a 12 volt one.

If you can find a 12 volt solenoid, you should use a small sealed lead acid battery, they are the easiest and safest batteries to work with. With a 12 volt battery, the IR LED would need a 220 ohm resistor and the other LED would need a 470 ohm resistor.

Thank you! I also need a small speaker on the front of the gun. Also about the solenoid. I think I have found for the pistols with a 0,7kg force.

http://www.amazon.co.uk/1-9lb-1-5lb-Linear-Solenoi...

But about the Arduino. So if I hook the micro to the battery will it be able to give power to all the components from there? Or do I need to hook them up seperately. Since you say the voltage regulator is in the micro.

The LEDs can be powered directly from the Arduino digital I/O pins through resistors. However, the solenoid and speaker draw too much power for the Arduino to handle, so they need to be connected differently. The speaker should be controlled by a NPN transistor (which is labeled as SWB in the picture below) and the solenoid must be controlled by a Logic-Level MosFet (shown as SWA in the picture below).

20160330_090629.jpg

So these two components control the voltage that is sent to the solenoid and speaker?

In a way, yes. They act as electronic switches, sending them a high signal will close them, sending a low signal will open them.

I'm just curious, how much experience do you have with electronics and/or microcontrollers?

Also just curious, what is this project you're working on? I heard gun,speaker, IR LED, and thought laser tag, but I don't see where a solenoid fits in.

Well I am only 15 but I have been working very ahrd for the past two years to become a programmer and I just got into embedded programming about two months ago. I am infact making a realistic laser tag game. The solenoids force is supposed to simulate recoil or kick so that the gun isn't too easy to shoot. So anyway I am more experienced with programming than I am with micro's but I mean everything can be learned.

Oh cool! I'm 17 and kinda the opposite, I've been doing electronics circuitry for several years, but recently started getting into programming through Arduino.

Ok, so if the solenoids are to simulate recoil, then they need to turn on and off very quickly, so they're going to draw a lot of power in a very short time. I would suggest connecting a large capacitor bank in parallel to the battery, as batteries don't appreciate large changes in current draw. Also, since it's a hand held device, and lead acid batteries are rather big and heavy, I would suggest using LI-ion batteries, three in series should do well. That would give a voltage of about 12.6v, which is a tiny bit over the solenoid rating, but should only serve to make the a little stronger.

That sounds great! If I understand it correctly the capacitor will hold some power so it can distribute it faster? Also have you programmed a micro before. Did you use a JTAG? Like a SAM-ICE? I don't know any other way to get my code into the micro and to actually know if it is doing what it is supposed to do.

Yes, the capacitor acts like a small battery that can charge and discharge really fast, it simply helps reduce wear on the battery, it isn't essential, but it would prolong the life of the battery.

The only micro controller stuff I've done is through the arduino ide, using development boards or just chips, I've never actually heard of a JAN or Sam-ICE.

Wait so how exactly did you program your chip? I am asking because a JTAG enviroment is expensive.

I've always used the Arduino IDE, simply because I was given an Arduino Uno and that's the first microcontroller I used. The Arduino IDE is a free download from Arduino.cc and works with many different microcontrollers. The level of coding used for the Arduino is way below anything that uses a JTAG or any type of dedicated debugging system. It's extremely basic compared to higher level programming such as java, python, or anything used in computer programming. It's a modified form of C++, which is a basic language to begin with. The draw back is that it take a lot of code to preform complex tasks.

Have you worked with an Arduino before?

No I am just using my knowledge of microcontrollers to figure this one out.

The Arduino language is very different from higher level programming languages, it's extremely basic, only a few steps above assembly level, making it much easier to debug, as such there is no automatic debugging system, the only tool for debugging it has is the Serial monitor, which you can print information to. You should play around with basic arduino stuff before attempting a project like this, just look up Arduino in Instructables, and pick one if the beginner's guides, there are a couple really goo ones. Once you get a feel for the Arduino programming style, it should be pretty easy to write the program for this project. If you have programming experience, it shouldn't take you more than a few hours to get the basics.

Okay thanks! I will do that.

Then how did debug on the target?

Oh and about the capacitor. Since it's a pistol it will only have 7 shots that can be fired relatively fast but is that already enough to need a capacitor?