Electronics > Beginners
Bit of checks
alarai:
Hello,
That will be my first post here and most likely not the last.
First of all please bear with me I'm an absolute electronics beginner. I've some very old memories of a bit of Technology classes with the relation with Voltage/Intensity/Resistors.... Unfortunately that teacher was not great and as for the realisation of the project, let's just say that not once in the four years there was this subject did we ever managed to complete a project, although I was very interested in doing so. So I'm sure I may have done mistakes although it seems to work on my messy test bench (check picture attached) for which I did a small PCB which ends up working just fine, but it was nothing like what I'm going for, which is to just have everything on a single "quite big" PCB in the end.
My very basic project is to replicate the panel that controls the autopilot functions of a Boeing 737, all that to link it to my computer and to my flight simulation program. That has been a very long time thing I wanted to do, and I finally got the time to go for it. I'm a programmer so I knew I could come up with a solution for the programing part. Which is why this will all be linked to an Arduino/Genuino Mega board. As the picture do not show it the whole thing is actually working well as far as I can tell. So that's why I'm onto the next step to make it a nice real thing. And my objective in the end is to make all of this available to anyone that want's it. Basically Open Source Software and Hardware.
So you will find attached my complete schematic which I've made through KiCad 5 in PDF. I've tried to use busses and hierarchy so that it's not too messy, so I hope I did it well. It's exactly what I have on the breadboards. And the first page lots of connectors will match the same connectors of the Arduino, basically the idea I have doing this is to upt pins in those places and just link it this way to the Mega board. That way Should I do anohter board for another cockpit, I could just use a single Arduino Mega board and swap it on the right panel to use.
To give a summary there is :
* 17 simple leds (green one) which I drive through two 74HC595 ICs and the 17 one is directly linked to an Arduino Input as it would be too much to add another IC for just one LED.
* 21 buttons of which 17 are push buttons and 4 are toggle switches, which inputs I get through three CD4021 ICs
* 6 rotary encoders
* 6 displays of digits which are each one driven by a MAX7219 IC and will have depending on the need either 3, 4 or 5 digits (1 three digits display, 2 two digits displays or 1 three digits and 1 two digits displays respectively)
From my time spent on making this I've made sure that there is no ERC error in KiCad, and I've also made sure that each IC has it's own 0.1µF ceramic capacitor between it's VCC and GND (which I know should be as close as possible to the V+ pins when doing the PCB). An exception is the MAX7219 which also have an additional Electrolytic 10µF capacitor as per the datasheet instruction).
So obviously to me beginner it seems alright like I did it, but before going further, I think I'd try to get some advices to not make something wrong, as the later stage already seems quite daunting just placing everyting properly on the PCB and wiring seems like a daunting task.
Thanks for reading this very long post (I know I tend to write too much) and for the upcoming answers and advices which will be very helpful to me to finally get this little baby done, which is done in the breadboard, but obviously not usable in this sate :)
Cheers
Brutte:
Hi and welcome.
My remarks:
1. Breadboards hate when you are shuffling these around. Glue them to some plywood. Make some holder for arduino, standoffs and mounting holes for PCBs.
2. Your schematic copies and pastes same design several times, with minimal changes. IMHO you should have designed one generic display. Do you really need 4 designs with 2,3,4 and 5 digits? Make a 5 digit one and reuse it. You can always leave some parts unpopulated.
3. LEDs use quite a lot of current. Are you sure this is capable of working from USB? Did you try 88888888?
4. The MAX7219 has SPI interface. Just connect all of them daisy-chain.
5. For current setting for MAX7219 I'd use a potentiometer instead of a fixed resistor.
6. Why do you use MAX7219 for 7-segment and 74HC595 for LED? Again - reuse the design and the library and do not multiply designs (unless there is a good reason behind that decision).
rstofer:
Definitely consider one of the Maxim display drivers.
https://www.maximintegrated.com/en/products/power/display-power-control/MAX7221.html
I did a Microsoft Flight Simulator external control project some years ago and it was pretty interesting code. I used one of the Teensy 2.0 CPUs because PJRC provided RawHid USB code.
https://www.pjrc.com/teensy/rawhid.html
I have also used one of the Maxim 16 digit display drivers for another project. It is basically just a 40 pin DIP with SPI in and the usual LED driver outputs. You can find various versions on the web site. Whether you can find them in stock is a separate problem. Maxim parts are sometimes hard to source.
16 digit driver MAX 6954
https://www.maximintegrated.com/en/app-notes/index.mvp/id/3210
16 digits on a single SPI channel. A really nice chip.
https://www.digikey.com/products/en?keywords=max6954
It's actually in stock at DigiKey in a 40 pin DIP - the exact one I used.
mariush:
I'd add something like 47-100uF near the 0.1uF decoupling capacitors on chips which have the potential of consuming bursts of current all of the sudden.
You should consider using a LED driver IC to drive your LEDs.
The shift registers are fine but there's some fineprint : most have around 25mA current limit per pin and around 70-100mA overall current limit. So even if you limit current to each LED using resistors to something like 15mA, if all leds are lit you may exceed the overall current limit and your LEDs may become dimmer.
There are cheap led driver ICs that are basically a combination of a shift register and current limiting, so you can use them just like shift registers and you set the current limit for all leds with just one resistor. In addition to that, some even let you send a command through i2c or spi that lets you set brightness to a percentage or level (ex 256 levels, a 8 bit value) which sets the leds to a percentage of the maximum current you set with the resistor.
For example, check out TLC5916IN or TLC5917IN , a 8 channel shift register ... each channel can do up to 120mA and you can set maximum current with one resistor and adjust output current by setting a 8 bit value (output current between 3mA and 120mA ... or the maximum current set by your resistor)
So it is a bit more expensive, but you're not having to add one resistor for each led, you only need one resistor per shift register
They're serial, you only need 4 wires to control multiple of these, you can chain them together like regular shift registers, see page 22 in the datasheet: http://www.ti.com/lit/ds/symlink/tlc5916.pdf
Also notice you can power the chips themselves with 3v..5v and you can power the LEDs separately with up to 20v, so for example if you have a 12v power supply / wallwart adapter or 18v laptop adapter, those leds could be powered directly from this higher voltage and the led drivers will limit the current just fine. This takes the strain out of the 5v power supply ... for example if you set the led current to 10mA, you don't have to worry about 17x10 = 170mA of current loading your 5v linear regulator or USB.
As for your buttons, what I would suggest is to use port expanders.
A port expander is a chip which creates multiple I/O pins, which can be set to input or output and you can read the state or set the state of each pin from your microcontroller through SPI or i2c.
Here's for example some super cheap 16 I/O port expanders:
Microchip MCP23017 (i2c) : https://www.digikey.com/product-detail/en/microchip-technology/MCP23017-E-SP/MCP23017-E-SP-ND/894272
Microchip MCP23S17 (SPI) : https://www.digikey.com/product-detail/en/microchip-technology/MCP23S17-E-SP/MCP23S17-E-SP-ND/894276
You could chain two of these (giving each unique address on the i2c bus or just by using the serial passthrough, pinout is the same on both chips, the i2c version just has two disabled pins that are used for serial on other version) and you get 32 I/O pins.
Another benefit of using these is that they support interrupt on change, meaning you can configure them to send you a signal when the state of a single pin changes (like when you'd push a button). So provided you have decent debouncing in your code, you would have to read the state of your buttons only when your Arduino receives an interrupt from the expander chip... so instead of reading 100 times a second, you may read only 20 times a second, whenever a button changes state.
If you feel like you need a resistor for buttons you could consider resistor arrays... for example see this 8 x 1k resistor array : https://www.digikey.com/product-detail/en/bourns-inc/4609X-101-102LF/4609X-101-102LF-ND/3593658
You connect pin 1 to 5v and the other 8 pins to each button or switch, so when you press a button, 5v goes through button/switch, limited by the 1k resistor
It's more expensive, yes, but you're saving on PCB space, pins, etc... if the buttons are grouped close together.
However, for just buttons, considering you have 21 inputs, you could do a trick if you want to save some money :
* have one 16 I/O port expander
* configure the first two pins as output , and the other 14 pins as inputs.
* power the first 14 buttons from the first pin that's set on output , and power the remaining buttons from the second pin set on output , connect the second pin of all buttons and switches to your 14 pins set on input (one button/switch from each set to one input pin)
* this works if you don't send power to both sets of buttons at the same time, it's like multiplexing ... this way you can connect up to 28 buttons / switches on your 14 input pins of your port expander chip.
In your Arduino, you can set the first output pin high and the second pin low, and now only the first 14 buttons receive power. Wait a ms, then read the 14 inputs ... if a button is pressed, then you get some voltage on your input pins.
Now turn off the first output pin and turn on the second pin, wait a ms or so and read the other set of 14 buttons
If you read buttons every ms, you can basically read all 28 potential buttons 500 times a second (if you wait 1ms between each reading of buttons)
The MAX7219 are kind of expensive but if you already bought them, I guess you could use them.
If you're not afraid of a tiny bit of surface mount soldering (you can solder these to an adapter board which converts them to DIP) you could have used led driver ICs which have lots of channels.
For example, this TLC5955DCAR has 48 channels, so you could easily display up to 6 digits at the same time using one ( 7 segments + dot , times 6 = 48 channels) and they cost 5$ each if you buy 10, compared to around 10$ for a single genuine MAX7219
They also have maximum current limit (30mA), and you can power the LEDs themselves with up to 10v (so if you have a 12v power supply, you could use a 7809 linear regulator to power the leds instead of using 5v)
These use SPI, so again you could have all your displays on a single SPI but, chaining all the displays with 6 wires (voltage, ground, serial in and out, clock , latch)
rstofer:
I would build up a PC with the Maxim 6954 chip, a header for the SPI data, clock and ground to come in, a header for the power/gnd and headers for each display. That's all I board would have on the board.
For each display, I would build small PCBs to mount the 7 segment displays with as many digits as seems appropriate and a header to match whatever I brought out of the master board above.
I would want these displays to be modular and built in some easily managed scheme.
There are also display drivers for individual LEDs or, more likely, an array of LEDs.
I tend to use locking MTA style connectors like this:
https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/640445-6/A1973-ND/109099
Or, I might see if these will work:
https://www.sparkfun.com/products/11441
With these displays, all the hard work is done. Unfortunately, they will all be 4 digits. Maybe that could still work...
Navigation
[0] Message Index
[#] Next page
Go to full version