Re: suggestions for 3 digit 7-segment display counter.
Yeah, but I prefer to etch my own boards. We got a laser now, and I want to try the transparency / laser printer / UV exposure thing. I think it'll be fun.
I was looking at some PICs and I think the PIC16F886 will work, especially if I use I2C or SPI for the keypad. It's fairly cheap and I have a generic PicKit3 (not made by MicroChip). I have everything I need to program the chip. I might even have a 28-pin socket around here somewhere that I might be able to put it in. I think Mariushm recommended the PIC16F886 as well. Kinda neat my searching came to the same PIC he recommended.
That PCBWeb Designer software is very lacking. I want to find something better. The main issues I've found is the component library isn't very large. It has the PIC16F886 in it, but the component isn't fully defined and it wants me to edit the part. A lot of components seem to not be fully defined and I have to edit them to add a footprint and all that jazz.
Another issue, it just seems to not have a lot of features. It just seems really limited. The copyright on the About page shows 2014. So maybe it's been abandoned or something. Guess it's time to go back to searching for a good free (or fairly cheap) PCB layout / schematic editor.
I want one where the PCB layout is linked to the schematic editor, like Eagle does. So if the schematic shows a resistor connected to an LED, in the PCB Layout editor, the two will be connected with a trace and I just have to move it around on the board.
Announcement
Collapse
No announcement yet.
suggestions for 3 digit 7-segment display counter.
Collapse
X
-
Re: suggestions for 3 digit 7-segment display counter.
the dev board is for developing
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Originally posted by stj View Posttolerance can mean how much it can drift at different temperatures.
btw, if you look at the tiny arm pcb i linked,
http://www.ebay.co.uk/itm/291693366485
this may be good!!
http://electronut.in/stm32-start/
I don't mind using an ARM processor, but I do not want to use a development board. I want to etch the board myself and do all the soldering, etc, at least for this project.
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Originally posted by mariushm View PostAh yes, the cheap keypads (4x3 or 4x4 are just boring simple matrix)
Here's an example for 2 cheap models of keypads: https://cdn.badcaps-static.com/pdfs/...58e95cc733.pdf
Some models are available only with 7-8 pins and you have to do some fun stuff with the microcontroller to detect what button is pressed, others have on pin for each button and a common pin (for voltage or ground or whatever).
First thing was how to burn out an LED. It didn't say we were burning out the LED until after you burn it out. If I knew we were going to burn out the LED, I wouldn't have done it! But eh, I learned what voltage divider circuits where and how to calculate the resistor value needed to get the voltage I desired.
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
tolerance can mean how much it can drift at different temperatures.
btw, if you look at the tiny arm pcb i linked,
http://www.ebay.co.uk/itm/291693366485
this may be good!!
http://electronut.in/stm32-start/
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Originally posted by mariushm View PostKeypads are easy, and can be done in multiple ways.
The easiest would be to connect every button to an input pin of your microcontroller but that uses a lot of pins.
Another method would be to use the built in ADC (analogue to DC converter) to convert an analogue voltage to a value.
Most PIC micros have 10bit ADC and some have built in voltage references or can use input voltage as maximum voltage. So for example, you can power the PIC with 5v and you can configure the voltage reference to 4.096v and then the ADC will return a number between 0 and 1023, basically 4 mV per step.
If you use the 5v input voltage as "reference", you just divide 5v by 1024 and multiply with the value the ADC gives you, to get the voltage on the ADC pin.
So now you can simply use resistors to create voltage dividers and whenever you push a button, you create a voltage divider which sends a voltage between 0v and 5v on that ADC pin and your microcontroller measures it.
See TIP 7 in the first PDF I linked to :
Whenever you press a button, there's always two resistors on the "top" side in series, and the fixed resistor on the bottom side. So the voltage the ADC pin sees is always (adapting the formula above)
Vout = Vin x [ Rbottom / (Rbottom + Rtop1 + Rtop2) ]
So just by using different resistors for each column and each line on that 4x4 matrix of buttons, you can make it so every time you press a button, you'll get a different voltage on the ADC pin (for example 16 buttons, 16 different levels, so you aim for 1024 / 16 = 64 steps or 64 x 4mV = 256 mv but you want some safety margin on both sides, like around 20mV ...
First button should output something between 0v and 256mV, with safety margins anything between 20mV and 230mV ... let's say aim for 0.15v
Second button should output something between 256mV and 512mV, with safety margins anything between 280mV and 490mV, let's say aim for 0.35v
.. and so on..
The problem with this scheme is obviously that you'd need a lot of 1% tolerance resistors and different values, which increases the cost of this.
You can do a sort of hybrid of this by splitting the matrix in 2 (2x4) and use 2 adc pins and scan half the keyboard first and then scan the other half
Or you can separate the columns at the top and power only one column at the top using a pin for each column (so for 4x4 matrix you'd have 4 output pins and one input pin used) and you'd need 4 consecutive adc conversions to determine if a button is pressed. You save money on resistors and you only need a few different resistors, but it takes more time to scan all the keys.
Note that these schemes save pins but obviously when you press two buttons at the same time, you get garbage, can't detect two or more buttons at same time.
If you want that, cheap options would be to use port extenders or shift registers that can work the other way around, meaning they have 8 or more input pins and you can read the pin states by using two pins on your micro (clock and data) ... this way, each button is connected to an input pin and your microcontroller reads the 8-16 pin states every time into a variable, so multiple buttons pressed at same time is no problem.
Ex 74HC597D https://www.digikey.com/product-deta...2822-ND/763089 (8 parallel in, 2 serial out)
You can also do hybrid style like use one output pin to send voltage to 2x4 buttons and read the 8 bits from the shift register, then turn off pin and use another output pin to power the other 2x4 buttons which are also connected to the same shift register... read the 8 bits again and you have the state of all 16 buttons using one shift register and 4 mcu pins.
Slightly more expensive (but cheaper than microcontrollers) are port expanders: https://www.digikey.com/short/3dcb2j
You get 8/16/16+ i/o ports that you can read state or set state through i2c or spi (2 pins on your micro) but they may also give you some benefits that your micro may not have (if it's on the cheaper side), like interrupt on change (so instead of constantly reading button states in a loop, just let the port expander IC interrupt the cpu through i2c and basically say hey a button state has changed)
Newer PIC micros have interrupt on change on specific ports or pins, so if you connect 8 buttons to 8 io pins on a port and then when someone presses a button, you automatically get an interrupt and make it so a function in your code is executed at that moment, instead of constantly checking if buttons are pressed.
I'm thinking of using the shift register and using the interrupts. I haven't played with SPI or I2C too much, so this would be a great time to learn about them. You guys have been more than helpful and have given me some great ideas.
A quick question about resistors and tolerances though. My understanding was the tolerance meant that the resistor could be off by whatever percentage the tolerance was when it was made. For example, a 100k resistor with a 5% tolerance would be 100k +/- 5%. Here's my question though. If I have a 100k resistor with a 5% tolerance, if my DMM shows the resistance to be 100k, that resistor is 100k, right? That tolerance doesn't mean that the value of the resistance can change + or - 5% over time, right? It'll always read 100k? If so, then the 1% resistors (if I went that route) might not be needed. I'd just have to sort through my fairly large collection of resistors to find ones that measure really close to what they're supposed to measure....
Thanks!
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
no,you still multiplex them because they are often wired that way internally, go look at the 2digit or 4digit pinouts.
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Originally posted by eccerr0r View PostWe were trying to use multiplexing where basically we'd flash the 7-seg displays at a high rate, and using persistence of vision to trick people into thinking all the digits are lit at the same time. This trick reduces the number of pins needed such that a single microcontroller with no external decoders needed to display a number - have it all done in software.
Using a 40 pin ARM processor, there are enough pins likely to drive all three digits directly and not need to multiplex... That's sort of what the old 7107 ADC does...
Nowadays, we have better microcontrollers and smaller microcontrollers with more pins than what we had a decade or two ago. Is it common practice now to drive the 7-segment displays directly and not use any decoders or converters (ie, the 7107)?
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Ah yes, the cheap keypads (4x3 or 4x4 are just boring simple matrix)
Here's an example for 2 cheap models of keypads: https://cdn.badcaps-static.com/pdfs/...58e95cc733.pdf
Some models are available only with 7-8 pins and you have to do some fun stuff with the microcontroller to detect what button is pressed, others have on pin for each button and a common pin (for voltage or ground or whatever).
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
we are talking about numeric keypads (9-0) not full keyboards!
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
The most modern mechanical keyboards don't multiplex buttons, or they only multiplex keys that are very far away or with different functions... like A and PgUp for example, combinations that aren't commonly pressed.
You can test the keyboard by simply keeping both SHIFT pressed at same time and typing "the quick brown fox jumps over the lazy dog" or some phrase that has all the letters"
If some keys are multiplexed you won't see them show up on screen. It varies from controller to controller.
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
keyboards usually are matrix-based when you buy them.
usually 4x3
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Keypads are easy, and can be done in multiple ways.
The easiest would be to connect every button to an input pin of your microcontroller but that uses a lot of pins.
Another method would be to use the built in ADC (analogue to DC converter) to convert an analogue voltage to a value.
Most PIC micros have 10bit ADC and some have built in voltage references or can use input voltage as maximum voltage. So for example, you can power the PIC with 5v and you can configure the voltage reference to 4.096v and then the ADC will return a number between 0 and 1023, basically 4 mV per step.
If you use the 5v input voltage as "reference", you just divide 5v by 1024 and multiply with the value the ADC gives you, to get the voltage on the ADC pin.
So now you can simply use resistors to create voltage dividers and whenever you push a button, you create a voltage divider which sends a voltage between 0v and 5v on that ADC pin and your microcontroller measures it.
See TIP 7 in the first PDF I linked to :
Whenever you press a button, there's always two resistors on the "top" side in series, and the fixed resistor on the bottom side. So the voltage the ADC pin sees is always (adapting the formula above)
Vout = Vin x [ Rbottom / (Rbottom + Rtop1 + Rtop2) ]
So just by using different resistors for each column and each line on that 4x4 matrix of buttons, you can make it so every time you press a button, you'll get a different voltage on the ADC pin (for example 16 buttons, 16 different levels, so you aim for 1024 / 16 = 64 steps or 64 x 4mV = 256 mv but you want some safety margin on both sides, like around 20mV ...
First button should output something between 0v and 256mV, with safety margins anything between 20mV and 230mV ... let's say aim for 0.15v
Second button should output something between 256mV and 512mV, with safety margins anything between 280mV and 490mV, let's say aim for 0.35v
.. and so on..
The problem with this scheme is obviously that you'd need a lot of 1% tolerance resistors and different values, which increases the cost of this.
You can do a sort of hybrid of this by splitting the matrix in 2 (2x4) and use 2 adc pins and scan half the keyboard first and then scan the other half
Or you can separate the columns at the top and power only one column at the top using a pin for each column (so for 4x4 matrix you'd have 4 output pins and one input pin used) and you'd need 4 consecutive adc conversions to determine if a button is pressed. You save money on resistors and you only need a few different resistors, but it takes more time to scan all the keys.
Note that these schemes save pins but obviously when you press two buttons at the same time, you get garbage, can't detect two or more buttons at same time.
If you want that, cheap options would be to use port extenders or shift registers that can work the other way around, meaning they have 8 or more input pins and you can read the pin states by using two pins on your micro (clock and data) ... this way, each button is connected to an input pin and your microcontroller reads the 8-16 pin states every time into a variable, so multiple buttons pressed at same time is no problem.
Ex 74HC597D https://www.digikey.com/product-deta...2822-ND/763089 (8 parallel in, 2 serial out)
You can also do hybrid style like use one output pin to send voltage to 2x4 buttons and read the 8 bits from the shift register, then turn off pin and use another output pin to power the other 2x4 buttons which are also connected to the same shift register... read the 8 bits again and you have the state of all 16 buttons using one shift register and 4 mcu pins.
Slightly more expensive (but cheaper than microcontrollers) are port expanders: https://www.digikey.com/short/3dcb2j
You get 8/16/16+ i/o ports that you can read state or set state through i2c or spi (2 pins on your micro) but they may also give you some benefits that your micro may not have (if it's on the cheaper side), like interrupt on change (so instead of constantly reading button states in a loop, just let the port expander IC interrupt the cpu through i2c and basically say hey a button state has changed)
Newer PIC micros have interrupt on change on specific ports or pins, so if you connect 8 buttons to 8 io pins on a port and then when someone presses a button, you automatically get an interrupt and make it so a function in your code is executed at that moment, instead of constantly checking if buttons are pressed.Last edited by mariushm; 05-18-2017, 02:03 PM.
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
We were trying to use multiplexing where basically we'd flash the 7-seg displays at a high rate, and using persistence of vision to trick people into thinking all the digits are lit at the same time. This trick reduces the number of pins needed such that a single microcontroller with no external decoders needed to display a number - have it all done in software.
Using a 40 pin ARM processor, there are enough pins likely to drive all three digits directly and not need to multiplex... That's sort of what the old 7107 ADC does...
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Originally posted by mariushm View PostI tried to quickly make a schematic in DipTrace but I was lazy and opened up msPaint and then took out the picture of the PIC and the transistors from a couple of datasheets I opened from Digikey and pasted them on the canvas. Rest is just lines and rectangles and text tool.
Literally searched for the first cheap DIP package 28 pin PIC chip on Digikey because these usually have multiple full 8 bit ports. 20 pin or 16 pin or 14 pin parts usually have 2 x 4 pin ports, or they have 2 full 8 bit ports but one port may have an input only pin, and the other port may have more useful pins like the i2c/uart ones which you may want to use for other things.
I wanted to keep things as simple as possible.
You really can easily modify some code to use 4 pins from one port and 4 pins from another port (would be something as basic as shift left value by 4 or shift right value by 4 etc, but I wanted to explain as easy as possible.
The TIP2 picture is from an application note Microchip has something called Tips and Tricks .. i think they even include these pdfs on the PicKit 3 (programmer) CD:
1. Microchip Technology Inc. DS01146B Compiled Tips ‘N Tricks Guide https://cdn.badcaps-static.com/pdfs/...740bf3fe08.pdf
1.5. New Peripherals Tips ‘n Tricks : The Complementary Waveform Generator (CWG), Configurable Logic Cell (CLC), and the Numerically Controlled Oscillator (NCO) Peripherals https://cdn.badcaps-static.com/pdfs/...cd95914060.pdf
2. https://cdn.badcaps-static.com/pdfs/...2b6b382e71.pdf
3. https://cdn.badcaps-static.com/pdfs/...98cebbdeeb.pdf
So, without the BCD to decimal ICs, I'd need at least four 8-bit ports, unless I'm missing something.
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
I'm trying out some program called PCBWeb. It looks a bit promising. Here's a list to some site that lists the "10 best free" PCB layout / schematic editors. It seems the PCBWeb has a BOM section, which could be nice. I see it lists stuff from DigiKey. Maybe it's customizable and I can edit / add other stores, kinda like how in some browsers (ie, Firefox), you can set custom search engines. You'd go to some site, like badcaps.net, and the browser would say something like type test in the search box at badcaps.net. Afterwards, copy and paste the web address here. Then, in the future, you could just search badcaps.net from the browser without having to physically go to the website and do it manually.
It'd be nice if I could add different sources for the BOM, but if not, that's okay. The program also has board etching services or whatever they're called. So you can just pick one from the drop down menu and it'll tell you how much it'd cost to get that particular design etched from that company.
It's free and I've downloaded it and installed it. Just tried running it and I need to register for free to use it I guess, but if it turns out to be really good, I'll let you guys know. I'll check out fritzing
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
because you know c / c++ i would use an arm board and a serial display with a matrix keyboard - total cost well under $10
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
"fritzing" looks like a fast beginer soft.
http://fritzing.org/
another member is using it:
https://www.badcaps.net/forum/showthread.php?t=62229
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
I tried to quickly make a schematic in DipTrace but I was lazy and opened up msPaint and then took out the picture of the PIC and the transistors from a couple of datasheets I opened from Digikey and pasted them on the canvas. Rest is just lines and rectangles and text tool.
Literally searched for the first cheap DIP package 28 pin PIC chip on Digikey because these usually have multiple full 8 bit ports. 20 pin or 16 pin or 14 pin parts usually have 2 x 4 pin ports, or they have 2 full 8 bit ports but one port may have an input only pin, and the other port may have more useful pins like the i2c/uart ones which you may want to use for other things.
I wanted to keep things as simple as possible.
You really can easily modify some code to use 4 pins from one port and 4 pins from another port (would be something as basic as shift left value by 4 or shift right value by 4 etc, but I wanted to explain as easy as possible.
The TIP2 picture is from an application note Microchip has something called Tips and Tricks .. i think they even include these pdfs on the PicKit 3 (programmer) CD:
1. Microchip Technology Inc. DS01146B Compiled Tips ‘N Tricks Guide https://cdn.badcaps-static.com/pdfs/...740bf3fe08.pdf
1.5. New Peripherals Tips ‘n Tricks : The Complementary Waveform Generator (CWG), Configurable Logic Cell (CLC), and the Numerically Controlled Oscillator (NCO) Peripherals https://cdn.badcaps-static.com/pdfs/...cd95914060.pdf
2. https://cdn.badcaps-static.com/pdfs/...2b6b382e71.pdf
3. https://cdn.badcaps-static.com/pdfs/...98cebbdeeb.pdfLast edited by mariushm; 05-17-2017, 06:15 PM.
Leave a comment:
-
Re: suggestions for 3 digit 7-segment display counter.
Originally posted by mariushm View PostA simple PIC would do.
...
You'll need 8 + 3 pins, one for each digit. Or 7 + 3 if you ignore the dot.
There's also displays with 3 or 4 digits that have 10-12 pins or 8 pins per digit + one for each anode or cathode (you'd use something like ULN2003A for common anode digits as would be quite cheap) and you could link the segments of all digits together and multiplex the digits if you want to reduce the number of wires.
I tried KiCad but didn't like how I had to pick the package for every single component I added. I found that to be a real pain.
Leave a comment:
Leave a comment: