Announcement

Collapse
No announcement yet.

suggestions for 3 digit 7-segment display counter.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • eccerr0r
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Yes it was a kicad schematic I threw together to experiment with how to use it as I've never used it before. This was intended to sort of be a possible design solution to the presented problem.

    The blue bus was a detail I did not fully flush out, but normally the fat wires are buses (meaning, multiple wires in parallel) as a convention. Imagine it connected however you want, but you don't short out all the output pins together . Normally you'd specify which bits you want to connect to the bus but I didn't do that. For multiplexing you'd connect all the A segments together and then connect to one of the PBx pins through a resistor, say A segments to PB0, B to PB1, etc., then the decimal point to PB7.

    I didn't specify any values for any of the components either, so it's not like it's a finished product, and I don't think an op amp with one connects is really useful (though I am assuming the use of the programmable internal pullups in the 90S2313/Tiny2313 for the buttons...)

    Of the two GPL schematic capture programs I've used now, I think gEDA is closer to "professional" but gEDA is also quirky. Alas you have to use what you have to use, and you have to learn it...

    And yes I'd do the debouncing in software ... Reminds me of the other project I was working on, a soft SMPS with AT90S4433. It worked pretty horribly, but it drove an HD44780 LCD and had four buttons to control its operation that were debounced in software. As I didn't have enough CPU cycles as it is, I used the LCD refresh cycle as the delay for the button debounce...
    Last edited by eccerr0r; 05-21-2017, 03:49 PM.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by eccerr0r View Post
    ...Actually know what, omitting digit drivers is probably not a good idea. Version 2...
    Quick question here. Those PDFs were creating in KiCad, right? How are we supposed to read the blue trace coming from the LED segments? Is that how KiCad drew them, or did you just do it that way to save time or something? Is it pin 1 of the LED segment is connected to PB0 (pin 12) of the DIP20 package, pin 13 of the LED segment is connected to PB1, so on and so fourth? Pin 9 of the LED segment would be connected to PB7?

    Thanks.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by eccerr0r View Post
    heh, I'm going to give kicad another chance sometime. Unfortunately every cad tool has its quirks.

    I thought I saw a demo where the guy moves a part and all the wires stay connected to it...

    Unfortunately it's "new" to me, always annoying to work with new software and go away from something that "just works"...
    Yeah, same here. I saw a demo just like that. I think it's all about learning how to do it properly. I've been watching the videos on their site. The quick 20-minute (or so) start-up video by some guy was nice, but he used a lot of keyboard shortcuts. He suggested a person memorize them and maybe do some custom mapping. For me, that's a bit hard. Neurologist I see is having me tested to see if I got the early onsets of dementia now. Some days, my memory works great, other days, it seems to be really bad. I keep trying to challenge my mind though, hoping that at least slows down the degradation of the white matter.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by mariushm View Post
    ...KiCad is open source and free but has a lot of quirks which may make it harder for someone to later transition to other software products considered more "professional"...
    I thought KiCad was supposed to be "professional". Is that not the case? I thought it was like Adobe Photoshop is to The Gimp as Eagle is to the KiCad. I thought Eagle Pro was used by a lot of professionals, but if you wanted a free open source equivalent, that was KiCad. Is KiCad more for just hobbyists?

    I found Eagle easy to use, whereas I found with KiCad, I've had to do a lot of learning. With Eagle, I was able to figure a lot out just by playing around, but with KiCad, I have to search google to learn how to do almost everything!

    I'll give the other softwares you mentioned a try if I struggle with KiCad.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by mariushm View Post
    - . I think it would help NOT quoting my huge messages every time you reply. -
    I'll make sure not to quote the whole post from now on, with the larger posts.

    Originally posted by mariushm View Post
    ...As for debouncing, for just 1-2 buttons, I generally find it enough to just use a resistor and a capacitor .. the resistor would limit the current and charge speed and the capacitor basically blocks the erroneous hits..

    5v ... [ resistor ] ---[button ] ---[ capacitor to ground ] -- [ input pin ]
    I will try this. I purchased a book the other day at Barnes and Noble. It's called Practical Electronics for Inventors (4th edition). I understand how to pick what voltage a capacitor needs to be rated for when I'm building a circuit, but I still don't understand how to figure out what capacitance I need. Also, I still don't know how to figure out what ripple current rating they need to be rated for and how to determine what ESR value the cap should have for my desired needs. Hopefully this book fills in the gaps.

    Originally posted by mariushm View Post
    ...In software, some very simple debouncing technique would be to just read the pin state multiple times and change the internal state when enough 1s or enough 0s are read.

    ...A simpler version could be made which uses more memory in theory (probably works best with 2 or 4 bytes for each input) but saves cpu cycles because you don't have to check if number is higher than 255 or lower than 0 when adding or substracting...
    I might give these software solutions a shot, just to see how they work. My technique, so far, has been to check for a button press, and if detected, just wait 200ms or so, and then loop until it's no longer pressed. It seemed to work, but I wanted to learn about hardware solutions and you also gave me some great ideas for other software solutions to try, which might be a bit more efficient / accurate.

    Originally posted by mariushm View Post
    Other solutions ... read about schmitt triggers and how could be used to debounce ... there's even special ICs to do debouncing (but usually expensive and actually meant to be used for high frequency switches not manual push buttons)
    I've read about the schmitt triggers and debouncing but I'll reread it. Maybe it'll make more sense to me now. I also seen those expensive debouncing ICs before. I'll read through the links you sent me. Thanks!

    Leave a comment:


  • eccerr0r
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Why am I looking at datasheet again, yes, the 90S2313 can sink enough current to not need the digit drivers in CC configuration but not CA. The LEDs won't be extremely bright but should be sufficient to be visible with an average current of 1.5mA per segment or so. For LED brightness, yes, need the digit drivers.

    Leave a comment:


  • eccerr0r
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Actually I was sort of able to straighten a piece of wire without redrawing, but it's not as intuitive as in gEDA. A lot of right clicking is needed, and very confusing.

    Back on topic I guess...

    ok fixed the overshoot... welcome to my first kicad schematic.

    oh gawd screwed up again, need to edit more...

    I forgot if the 90s2313/tiny2313 could sink or source more current. I think it's sink, and should be using CC MAN74s instead of CA MAN71s. Actually know what, omitting digit drivers is probably not a good idea. Version 2...
    Attached Files
    Last edited by eccerr0r; 05-20-2017, 01:20 PM.

    Leave a comment:


  • eccerr0r
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    heh, I'm going to give kicad another chance sometime. Unfortunately every cad tool has its quirks.

    I thought I saw a demo where the guy moves a part and all the wires stay connected to it...

    Unfortunately it's "new" to me, always annoying to work with new software and go away from something that "just works"...

    Leave a comment:


  • stj
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    well i just tried kicad.
    i draw a bad schematic - intentionally.
    then tried to edit it.

    my conclusion is that it's either poorly documented - or it's bullshit.

    draw a wire between 2 points with a bend or 2 in it.

    then try to grab it and bend it straight - you cant - the whole wire just moves on the grid without changing shape.

    so the only way to correct it would be to delete it and draw it again.
    it also probably means you cant drag large parts around the sheet later and have all the wires follow it.

    i wanted a schematic entry tool, not a fucking paint package - if i wanted that i could use gimp.

    back to eagle!

    Leave a comment:


  • eccerr0r
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    I've been using gEDA, didn't know Kicad was OSS as well, so I installed it. Running on Linux.

    Gosh, UI of gEDA gschem and kicad themselves are so different from each other... I guess I'll need to figure out kicad as there seems to be a bigger following.

    Leave a comment:


  • stj
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    i dont design boards, i reverse engineer them.
    i have drawn huge multi-page schems with probably several thousand pins on the free version of eagle!!!!!

    Leave a comment:


  • mariushm
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    It's better than eagle which limits you to 100x80 and 2 layers or something ridiculous like that.

    DipTrace has the 500pin limitation but if you ask nicely some distributor or reseller, you may get a higher limit. They're allowed (but not required) to give people keys with the limit set on 1000 pins.

    ps. And you can easily find serial keys for DipTrace online if you really want to pirate it.


    KiCad is open source and free but has a lot of quirks which may make it harder for someone to later transition to other software products considered more "professional". Persons whould have to re-learn some things and it can be annoying.

    I can also suggest Zuken CADSTAR, though the free version is limited to 300 pins and 50 components : https://www.zuken.com/en/products/pc...ftware/express

    It's heavily used in Asian countries and Sony used to work with this one a lot, not so popular in other parts but it's good software.

    Leave a comment:


  • stj
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    i cant use something with pincount limits

    Leave a comment:


  • mariushm
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    - . I think it would help NOT quoting my huge messages every time you reply. -

    I recommend trying out DipTrace ... may be easier to understand than KiCad and it's free for simple circuit boards (2 layers , 500 pin count or something like that)
    There's good tutorials (easy to follow and learn) inside DipTrace and on their website.


    As for debouncing, for just 1-2 buttons, I generally find it enough to just use a resistor and a capacitor .. the resistor would limit the current and charge speed and the capacitor basically blocks the erroneous hits..

    5v ... [ resistor ] ---[button ] ---[ capacitor to ground ] -- [ input pin ]

    For example let's say 1kohm for resistor , 1uF ceramic for capacitor.

    When you press the button, the capacitor slowly charges to 5v. If you have some random 1s and 0s and 1s, the capacitor simply filters those 0s and it slowly charges.
    When the capacitor charges up to around 0.7v or 2v (threshold depends from micro to micro) you get the HIGH / 1 on that input pin.
    When the button is released, the internal resistance on that pin of the micro (and whatever protection circuitry is there) will slowly discharge the capacitor back to nothing, so very quickly you'll have LOW/0 on the pin
    It's basically just a few us delay between pressing/releasing button and getting the changed state.

    In software, some very simple debouncing technique would be to just read the pin state multiple times and change the internal state when enough 1s or enough 0s are read.
    For example, have a byte variable (0..255) .. every 1 read adds to the variable, every 0 decreases the variable by 1 .. but make sure you don't go below 0 or above 255. When you have a number higher than let's say 10 you know maybe 10 out of last 15 reads are 1s so the button is probably pressed. When the number goes down to 0, then the button is probably not pressed.

    A simpler version could be made which uses more memory in theory (probably works best with 2 or 4 bytes for each input) but saves cpu cycles because you don't have to check if number is higher than 255 or lower than 0 when adding or substracting
    For example, you have an unsigned int (16 bit variable) that's 0 initially .. every time you read the button state you either shift to left and add 1 if the button is 1, or you shift the number to the right if the value is 0.
    When you have 8 consecutive bits on the right (basically you do something like number & 0xFF == true or something like that), you're fairly confident that the button is pressed.
    Shifts and additions are fast (1-2 cycles) while if then else would use more cycles.

    Other solutions ... read about schmitt triggers and how could be used to debounce ... there's even special ICs to do debouncing (but usually expensive and actually meant to be used for high frequency switches not manual push buttons)

    Here's a good paper (includes my simple RC filter solution to hardware debouncing on page : https://cdn.badcaps-static.com/pdfs/...6fc31016ff.pdf

    Here's another good page: http://www.labbookpages.co.uk/electronics/debounce.html

    I probably could have saved 15 minutes of my life and just paste these links but i didn't think of googling it before answering.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by mariushm View Post
    Some clarifications...

    The 1% tolerance or the 5% tolerance means the value of the resistor will be within -1% .. +1% or within -5% .. +5%

    In real world however, what usually happens is that manufacturers try to make all resistors as precise as possible and then may or may not use laser trimming to make the resistors even more precise.

    Also these days the manufacturing process today is good enough that most resistors that are made are already precise enough, so there's generally little interest to bin the resistors aggressively.


    In the case of +/- 1% resistors, you'll probably find that if you take 1000 resistors out of a box, most will be around below +/- 0.3-0.7%
    Maybe if you take 1000 and measure the resistance of each resistor, you may find out that there's no resistor within +/- 0.2% , it could be possible that the manufacturer took those out to sell them as +/- 0.5% tolerance

    In the case of +/-5% resistors, basically it's kinda of whatever is less precise than 1% ... you'll get anything between +/- 1% to 5% but from experience the majority of 5% resistors I used are usually within 1.5%...2.5%

    Another thing you have to keep in mind is temperature fluctuations... it's some value advertised in ppm (parts per million) ... 5% resistors' value often varies more with temperature change, the resistance drifts more towards the edges of that 5% tolerance or may even exceed it.

    Here's a good video about resistor values and tolerance, you can see how resistor values are distributed in a box of resistors : https://www.youtube.com/watch?v=1WAhTdWErrU


    Some notes about multimeters :

    What you measure depends multimeter's accuracy , depends on the number of counts the multimeter has and depends on whether the multimeter has a RELative mode or not.
    The probes you use have their own resistance which is small but it's there (usually less than 0.2 ohm) so usually it doesn't matter when you try to measure a 100 kOhm resistor (the tiny resistance won't change the result too much).
    However, for proper measurements you would normally short out the probes of the meter by touching them together and then pressing the REL button on the meter when the display is stabilized.

    Then, the value on the multimeter will depend on the meter's count number and it's accuracy.

    For example, you may have a 4000 count multimeter rated for a (+/- 1% +2) accuracy ... that's +/-1% + 2 digits.
    A 4000 count multimeter would typically auto-range like this :

    0.000 ohm .. 400.0 ohm
    400.1 ohm .. 3.999 kohm
    4.000 kohm .. 39.99 kOhm
    40.00 kOhm .. 399.9 kOhm
    [..]
    So if you measure a 100 kOhm resistor, the multimeter may read 100.06 kOhm or 100060 ohm but you only see 100.0 kOhm on screen (and you may think the resistor is perfect at 100 kOhm.

    Also remember the accuracy which could be +/- (1% + 2 digits)

    1% of 100'000 ohm is 1000 ohm, so the multimeter may output anything between 999 kohm and 101 kohm PLUS 2 digits and technically it does its job right (in reality, the meters are usually calibrated to measure better than extremes of 1%.

    I have a Uni-T UT61E which is 22000 count and has +/- 0.5% +10digit accuracy on the 100 kOhm range.

    So on screen, a 100 kohm would show up as 100.00 kohm (the 22000 count allows for an extra decimal) and the better accuracy would also reduce the error of the multimeter... this means my multimeter may show on screen a value closer to the actual value of the resistor.


    Another important note

    For reading voltages using ADC pins on micros, you want the resistors that form the voltage divider to be relatively small, let's say below 10kohm ... with high values there's too small current flow for the adc to properly sample data in reasonable amount of time.
    So I'd suggest using something like 1000-4700 ohm as the bottom resistor and then maybe use 100 / 150 / 220 / 330 / 470 ohm etc resistors at the top, values from E24 (easy to buy) and whatever is 1% and that would give you those voltage steps when doing the math.
    The microcontroller documentation (datasheets) has some notes about this.
    Okay, good to go. I didn't take into account the accuracy of my DMM. It's old and probably needs to be calibrated as well. It does have the REL button and I use that regularly. Didn't ever think about the probes having resistance, I always just thought my DMM wasn't properly calibrated! Thanks for pointing that out.

    I want to look into using SPI or I2C for the keypad. So, with that in mind, the 1% resistors would only be if I planned on using the ADC of the microcontroller, and not SPI or I2C, right? I'll go through and re-read everything probably tomorrow. It's been a busy day and my mind's all garbled now!

    I'm leaning towards I2C right now. I'd still need to debounce the keys, wouldn't I? I know how to do it via software, but I never found a good hardware way to debounce buttons. I've seen a couple ideas out there, but none of them seemed to do what I wanted. I just wanted the buttons debounced every time I hit them. There was a hardware solution which used transistors (I think), but I couldn't get it work the way I wanted. I'd hit the button, and it'd register as a hit, but hitting it a second time never registered again. If I remember though, this was the way it was designed to work. There were two buttons, if that matters.

    I don't really like the just wait a few hundred milliseconds and hope they can't push really quick software solution.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by stj View Post
    i use eagle, i need to get around to trying kicad - i have it installed.
    I went for KiCad again. I found a lot of how-to videos on their website and I guess I'll just have to get used to it. The layers on the PCB confuse me a bit still. Like F.brd and B.brd or whatever they are. It's just going to take some time adjusting to something other than Eagle. I like how it's free and there's a Windows and Linux version.

    The first quick-start video I watched showed a guy creating a new part, completing a schematic, and a PCB layout. I can just rewatch it a few times if I get stuck.

    Leave a comment:


  • mariushm
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Originally posted by Spork Schivago View Post

    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!
    Some clarifications...

    The 1% tolerance or the 5% tolerance means the value of the resistor will be within -1% .. +1% or within -5% .. +5%

    In real world however, what usually happens is that manufacturers try to make all resistors as precise as possible and then may or may not use laser trimming to make the resistors even more precise.

    Also these days the manufacturing process today is good enough that most resistors that are made are already precise enough, so there's generally little interest to bin the resistors aggressively.


    In the case of +/- 1% resistors, you'll probably find that if you take 1000 resistors out of a box, most will be around below +/- 0.3-0.7%
    Maybe if you take 1000 and measure the resistance of each resistor, you may find out that there's no resistor within +/- 0.2% , it could be possible that the manufacturer took those out to sell them as +/- 0.5% tolerance

    In the case of +/-5% resistors, basically it's kinda of whatever is less precise than 1% ... you'll get anything between +/- 1% to 5% but from experience the majority of 5% resistors I used are usually within 1.5%...2.5%

    Another thing you have to keep in mind is temperature fluctuations... it's some value advertised in ppm (parts per million) ... 5% resistors' value often varies more with temperature change, the resistance drifts more towards the edges of that 5% tolerance or may even exceed it.

    Here's a good video about resistor values and tolerance, you can see how resistor values are distributed in a box of resistors : https://www.youtube.com/watch?v=1WAhTdWErrU


    Some notes about multimeters :

    What you measure depends multimeter's accuracy , depends on the number of counts the multimeter has and depends on whether the multimeter has a RELative mode or not.
    The probes you use have their own resistance which is small but it's there (usually less than 0.2 ohm) so usually it doesn't matter when you try to measure a 100 kOhm resistor (the tiny resistance won't change the result too much).
    However, for proper measurements you would normally short out the probes of the meter by touching them together and then pressing the REL button on the meter when the display is stabilized.

    Then, the value on the multimeter will depend on the meter's count number and it's accuracy.

    For example, you may have a 4000 count multimeter rated for a (+/- 1% +2) accuracy ... that's +/-1% + 2 digits.
    A 4000 count multimeter would typically auto-range like this :

    0.000 ohm .. 400.0 ohm
    400.1 ohm .. 3.999 kohm
    4.000 kohm .. 39.99 kOhm
    40.00 kOhm .. 399.9 kOhm
    [..]
    So if you measure a 100 kOhm resistor, the multimeter may read 100.06 kOhm or 100060 ohm but you only see 100.0 kOhm on screen (and you may think the resistor is perfect at 100 kOhm.

    Also remember the accuracy which could be +/- (1% + 2 digits)

    1% of 100'000 ohm is 1000 ohm, so the multimeter may output anything between 999 kohm and 101 kohm PLUS 2 digits and technically it does its job right (in reality, the meters are usually calibrated to measure better than extremes of 1%.

    I have a Uni-T UT61E which is 22000 count and has +/- 0.5% +10digit accuracy on the 100 kOhm range.

    So on screen, a 100 kohm would show up as 100.00 kohm (the 22000 count allows for an extra decimal) and the better accuracy would also reduce the error of the multimeter... this means my multimeter may show on screen a value closer to the actual value of the resistor.


    Another important note

    For reading voltages using ADC pins on micros, you want the resistors that form the voltage divider to be relatively small, let's say below 10kohm ... with high values there's too small current flow for the adc to properly sample data in reasonable amount of time.
    So I'd suggest using something like 1000-4700 ohm as the bottom resistor and then maybe use 100 / 150 / 220 / 330 / 470 ohm etc resistors at the top, values from E24 (easy to buy) and whatever is 1% and that would give you those voltage steps when doing the math.
    The microcontroller documentation (datasheets) has some notes about this.
    Last edited by mariushm; 05-19-2017, 04:11 PM.

    Leave a comment:


  • stj
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    i use eagle, i need to get around to trying kicad - i have it installed.

    Leave a comment:


  • Spork Schivago
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    Do you know Kicad? How hard was it to learn? I didn't like how I had to add the footprint to every part I added.

    Leave a comment:


  • stj
    replied
    Re: suggestions for 3 digit 7-segment display counter.

    your pretty much limited to eagle & kicad if you want a big upto date library and dont want to spend a shitload of cash!

    Leave a comment:

Working...
X