Jump to content

Need help with picking parts for arduino project

pomaranc

So I am currently making panel based on 737 MCP for FSX. Something like this but a lot worse :D 

 

...anyway I barely know anything about this kind of electronics so I need some help picking the right parts.

I will be using arduino mega, MAX7219 for the 7 segments, now I need some buttons, flick switches and rotary encoders.

The buttons should be momentary but I guess toggle would work as well, ideally I just need one with LED inside so it will light up when it's on, I guess there would have to be independent LED on the momentary one or something.

What kind of voltage and current do I need them to be? (Yeah I really don't know sh*t)

Also I am not sure which rotary encoder is best for this use.

Do I need any external power?

 

Any help, recommending exact parts or just general advice is greatly appreciated.

 

BTW I am planning to buy mostly from aliexpress.

Link to comment
Share on other sites

Link to post
Share on other sites

an arduino works on 5 volts, and its IO cant do more than 50mA per pin if i recall correctly, so you'll never have currents to the point you need to worry about the current ratings of switches.

 

that should kinda answer that part of the question i guess :P

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, there's not much to overthink if all you're doing is putting switches to pins. Set the pins to input-pullup (no connection = high voltage) or input-pulldown (n.c. = low voltage), then have the switch connect to the opposite voltage level.

 

For wiring it up, I'd also get a nice load of 10K resistors in case you want to wire pullup resistors manually. Any LEDs will need current-limiting resistors - about 150-180 Ohm 1/8 W should work well, or you could get a big pile of 100s and put them in series if you want more (2 100s in series = 200 Ohms of resistance). A 50 Ohm resistor will work for two LEDs in series (two 100s in parallel is equivalent), and you probably cannot do more LEDs in series than that from a 5V source, so you might want to consider powering the LEDs from +12V and using some simple transistors to toggle them on from a 5V signal. You can use the tool at http://ledcalc.com/ to figure out how many LEDs you can get in series from a given supply voltage and what resistor value you need; and you can read http://www.rason.org/Projects/transwit/transwit.htm to learn how to use transistors as a switch so your 5V Arduino can switch 12V loads.

 

If everything is wired to the Mega, it'll need at least a 7V 1A power supply. 12V 600mA or so would work pretty well, too and is easy to come by. Giving 20 mA to every one of the 54 pins would take about 1080 mA of 5V power, or 5.4W. As long as the voltage * amperage (in amps) of your power supply is at least that ~5.4W number and the voltage is 7V or more (but less than 30V, ideally 24V or less), it's a sufficient power supply.

Link to comment
Share on other sites

Link to post
Share on other sites

These guys might have some stuff that may help, most notably joystick controllers that tuns inputs from pots and buttons into a serial signal for the computer.

ASU

Link to comment
Share on other sites

Link to post
Share on other sites

My advice would be to go with reputable online distributors of electronic components, they have pretty much all you need in one place so while each part individually may be more expensive, you can get all in one place and pay once for shipping and you get them in a couple of days.

 

If you're in US, you can go with Digikey.com or Newark.com or Mouser.com 

In Europe and other parts, you have Farnell.com (Newark.com european version), Mouser.com also works in Europe, TME.eu is good as well

 

My advice would be to avoid MAX7219 and get something that's cheaper and does the same thing, Maxim parts are expensive. There's loads of led drivers and max7129 is on the expensive side, either as common anode or common cathode (the two configurations led digits are configured)

 

Not saying the country, from the Steam account you have in profile it sounds like you're Polish or Czech, so maybe tme.eu or farnell.com would be your best choices.

 

Here's some suggestions from uk.farnell.com (they may have a version of the website for your own country) , i'm using this because it's easiest to use and switching to the one for my country after i save all the product codes in a list (you can then enter the product codes in the search box on the version of the site for your country and the results page gets you right to the product)

 

LED drivers (including max7219 if you're really stuck on it) : http://uk.farnell.com/led-drivers

buttons : look in next category at "tactile switches" for the ones you usually expect when you think of buttons, there's also with built in leds there..  and there's also the plastic covers for buttons usually in other categories on the site

switches :  http://uk.farnell.com/switches (you have there toggle switches for flip switches, slide switches, pushbutton switches, joystick switches, just browse through those and you'll figure out how all of them work, you have datasheets for the majority of them, unlike aliexpress products)

rotary encoders, optical encoders all kinds of encoders : http://uk.farnell.com/encoders (and you find knobs here http://uk.farnell.com/knobs and possibly in other places on the site , the plastic dial round thing that go on top,  for most of these encoders, you can select knobs based on diameter of thing ... i can't think of the word right now)

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

As for the power, USB should be enough. There's alot of LEDs but not enough to warrant external power I think.

 

The rotary encoders and switches does not have any special electrical concern since everything is logic level. Just go with whichever more realistic. 

 

On the controller side though, seems like you would need a lot of IO. At least a Mega if you're going the arduino path. One thing is that you would not want to power the LEDs directly off the MCU though, most Atmel chips can only take 200mA total. A few transistors as switch would be a safer path. Programming wise, shouldn't be too hard if you have figured out the way to interact with the PC.

 

Also you probably need a driver or program of some sort on the PC side to handle the inputs.

The Internet is invented by cats. Why? Why else would it have so much cat videos?

Link to comment
Share on other sites

Link to post
Share on other sites

LEDs today are fairly efficient, some high brightness red leds for examples can be quite bright even with 0.5 mA flowing through them. Most cheap leds are specified at 10mA default current in the datasheets, but the brightness doesn't increase linearly with the current, so the led will be bright even with just a few mA flowing through them.

Most microcontrollers can output up to a certain amount of current on each pin (for example for PIC micros the current is usually around 15mA), but overall (in total through all pins) the current amount is smaller, around 200-250mA. So, for example, if you get a 40 pin microcontroller, there's no guarantee you'd be able to output 10-15mA on all its 30+ IO pins.

 

You limit the current flowing through leds using resistors  (v = i x r  so for example for 5v and 5ma , 5v = 0.005 x r => r = 1000 ohm) . However, you're still wasting tiny amounts of power in each resistor (power = i x i x r) so there's smarter ways to do it. 

To get around the current limitations, you can use shift registers (you connect one to the microcontroller using only two wires and send 8 bits to it and the 8 outputs of the shift register turn on or off. Super simple but you still need resistors for each led to limit the current through each led.

There are LED drivers with several channels, and they have current limiting circuitry inside so you no longer need resistors because the chip limits the current internally. Some led drivers have up to 16 channels and you can put one or several leds in series on each channel and you can even send commands to led driver chip to increase or decrease the current on any channel independently and it's all done like a basic shift register chip, very easy to learn with an arduino ... example of such a chip would be TLC5940 : http://tronixstuff.com/2013/10/21/tutorial-arduino-tlc5940-led-driver-ic/

 

You can use some led driver chips to replace those MAX7### something chips which are expensive .. that maxim chip is basically a led driver like this one with some added circuitry inside that decodes numbers you send to it in order to know which segments of led digits to turn on or off - you can implement this functionality in your microcontroller and instead of sending numbers you send directly to microcontroller the 16 bits to tell it which of the 16 channels to turn on or off (so you control two alphanumeric digits at any given time, as there's 7 segments and a dot for each digit).

For four alphanumeric digits, you can just use two transistors to enable or disable power to each set of two digits so you can basically do something like this in your code.

* turn off power to both sets of digits

* send 16 bits of data to the led driver chip to tell it which of the 16 segments to sink to ground

* turn on transistor associated with one of the two sets of digits  (power goes into all leds, but circuit is completed only for the channels which are sinked to ground by led driver, so only those segments turn on)

* wait about 5-10 ms, turn off power

* send 16 bits of data to led driver chip with the segments you want to light up on the other set of two digits

* turn on the other transistor, wait 5-10 ms,  and go to the beginning of this loop.

Because it's refreshed so often, every 5-10ms, your eyes don't even notice that for half the time, 2 of the 4 digits aren't turned on. They'll just see all four digits lit up but at slightly lower brightness.

That's also what that MAX chip does inside, it just turns on one digit, waits a bit, turns off the digit and turns on the next, waits a bit, turns off the digit and goes to next one, and continues this in a loop but so fast you don't see it with your eyes.  

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×