New project - MSFS C++ USB interface - Page 3


+ Reply to Thread
Page 3 of 3 FirstFirst 123
Results 81 to 106 of 106
  1. #81
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by Ioannis View Post
    ...When the switch is at ground, the HC14 sees the voltage divider of two 10K resistors, so the voltage is at 2.5Volts.
    ...
    I would strongly recommend to increase the 10K pull up to 100K.

    Ioannis

    I'm going to test this using 10K pull-up and a 1K res and see what that turns out (I'd like to do the math, but my hair hurts ).
    Not as dumb as yesterday, but stupider than tomorrow!

  2. #82
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,766


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    You just need less than 2.2 volts at the input for the HC14 to interpret it as low. So, yes, either 100k/10k or 10k/1k combination is OK. Better 100k/10k though, because it will draw much less current.

    Ioannis
    Last edited by Ioannis; - 14th January 2024 at 20:18.

  3. #83
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,766


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    How many buttons will be pressed at the same time?

    Maybe state machine is another good solution for such a project. I can dig out an example for small amount of buttons that I am sure can be expanded for more. the advantage is that no pause is used because it is out of the state machine philosophy of operation.

    Ioannis

  4. #84
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by Ioannis View Post
    You just need less than 2.2 volts at the input for the HC14 to interpret it as low. So, yes, either 100k/10k or 10k/1k combination is OK. Better 100k/10k though, because it will draw much less current.

    Ioannis
    Thanks. Exactly what I wanted to confirm.

    That'll teach me to take a 15 year break from electronics.
    Not as dumb as yesterday, but stupider than tomorrow!

  5. #85
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by Ioannis View Post
    How many buttons will be pressed at the same time?

    Maybe state machine is another good solution for such a project. I can dig out an example for small amount of buttons that I am sure can be expanded for more. the advantage is that no pause is used because it is out of the state machine philosophy of operation.

    Ioannis
    In theory, only one button gets pressed at a time.

    It's essentially a button box; something like this:

    https://i.ebayimg.com/images/g/AX0AA...D1/s-l1600.jpg
    Not as dumb as yesterday, but stupider than tomorrow!

  6. #86
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,766


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Maybe then it is worth to try this:

    100 buttons means about 13 bytes.

    You can read that 13 bytes, store them in a temp array.

    Do whatever you want and a timer interrupt will get you back to read again the 13 bytes in about 10ms or whatever you want.

    Compare to the previous read in temp array. If there is a difference, you can jump to the appropriate sub using ON index GOTO or BRANCHL technique, for up to 127 or 1024 labels to goto.

    No pauses, no delays to the main program. An no 200 resistors and 100 capacitors along with a bunch of HC14's.

    Ioannis
    Last edited by Ioannis; - 14th January 2024 at 23:14.

  7. #87
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by Ioannis View Post
    ...No pauses, no delays to the main program. An no 200 resistors and 100 capacitors along with a bunch of HC14's.

    That is an interesting technique worth looking into.

    I also have several rotary encoders. You can spin those around quite fast. Not sure that would work with this technique.
    Not as dumb as yesterday, but stupider than tomorrow!

  8. #88
    Join Date
    May 2013
    Location
    australia
    Posts
    2,368


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    i agree with ioannis ,all that extra hardware will not add much value [if any] when you need to keep track off switch states anyway


    I also have several rotary encoders. You can spin those around quite fast
    getting multiple re's to work glitch free when other interrupts are involved is very challenging


    these things work great and are open sourced or you can buy some


    https://www.tindie.com/products/saim...er-on-i2c-bus/
    Warning I'm not a teacher

  9. #89
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by Ioannis View Post
    ...
    When the switch is at ground, the HC14 sees the voltage divider of two 10K resistors, so the voltage is at 2.5Volts.

    According to the datasheet, this will lead to not clearly defined state of low or high. Will depend on the HC14 type, brand and temperature.

    I would strongly recommend to increase the 10K pull up to 100K.

    Ioannis

    I can't do math since I can't remember squat. It's faster for me to pull out the breadboard and test it out. This is what I got:

    (corrected cause I'm senile)

    Name:  RC circuit.png
Views: 113
Size:  937.3 KB


    And this is the specs for the 74HC14 that I'm using:

    Name:  74HC14 thresholds.png
Views: 113
Size:  88.2 KB


    It looks like I'm better off using 100K-1K-100K or 10K-1K-10K to be sure to be in 2.5V range. I didn't check current consumption.

    I suppose the dude on that link used the 74HCT14 (at the bottom of specs). The positive-going threshold is about 1.5V, depending on VCC.
    Last edited by Demon; - 15th January 2024 at 04:23.
    Not as dumb as yesterday, but stupider than tomorrow!

  10. #90
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by richard View Post
    ...
    these things work great and are open sourced or you can buy some


    https://www.tindie.com/products/saim...er-on-i2c-bus/

    Now you're talking. I don't need all that RGB stuff, just rotary encoder with switch support is all I need.

    https://www.tindie.com/products/saim...-encoder-mini/


    I ordered 20 of the mini model to test, $2.28USD, turns out to $74.79CAD with normal shipping and exchange rate.

    Real interesting stuff. If everything is there to be open-source, I could even print my own.
    Last edited by Demon; - 15th January 2024 at 04:33.
    Not as dumb as yesterday, but stupider than tomorrow!

  11. #91
    Join Date
    May 2013
    Location
    australia
    Posts
    2,368


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    you sketch is incorrect , with button pressed v test == 0.45 v

    Name:  de.jpg
Views: 111
Size:  259.4 KB
    Warning I'm not a teacher

  12. #92
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by richard View Post
    you sketch is incorrect...

    I used this guys design.

    https://hackaday.com/wp-content/uplo...uncing-sch.png


    His explanation is here:

    https://hackaday.com/2015/12/09/embe...uttons-part-i/


    I've seen this design in other places. The 3rd resistor is to prevent the input pin from floating.
    Not as dumb as yesterday, but stupider than tomorrow!

  13. #93
    Join Date
    May 2013
    Location
    australia
    Posts
    2,368


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    i see , you need to know the leakage current from the ST gate input to calculate the voltages . after the rc time constant is allowed for of course
    seems messy to me , at 100k the button may never work depending on ST characteristics
    Warning I'm not a teacher

  14. #94
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by tumbleweed View Post
    You shouldn't leave the inputs of the HC14 floating... the outputs will be unknown.

    ...

    Oooops. I've since added a pull-down for the input I was using.


    I'm seeing several comments on google about connecting the unused pins to ground. If I'm not using their output, can a floating input disturb the other circuits?


    EDIT: I've googled some more and found this explanation:

    "...random charges accumulating there can/will cause unpredictable internal behavior in the chip, including oscillation and high power dissipation."

    https://electronics.stackexchange.co...-inputs-outpus
    Last edited by Demon; - 15th January 2024 at 05:26.
    Not as dumb as yesterday, but stupider than tomorrow!

  15. #95
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by richard View Post
    ..., at 100k the button may never work depending on ST characteristics

    That's why I tested using a pushbutton and checked the voltage out the RC circuit.

    The reading did fall to 0V for all configurations.
    Not as dumb as yesterday, but stupider than tomorrow!

  16. #96
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,766


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Better be on the safe side. Richards #91 is the one I would use.

    But then you can ditch all that stuff if your ports support internal pull up and just read them in software as described in #86.

    Ioannis

  17. #97
    Join Date
    May 2013
    Location
    australia
    Posts
    2,368


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    the pull down resistor is a bad idea, the hackaday article [if you wish to trust it] does not have one and does not suggest one.
    biasing cmos inputs to values inbetween logic high and logic low thresholds is a proven method for making oscillators , i would not recommend it as a debounce cct. the input pin in the article is never in a floating state regardless of button state, unused cmos input pins cannot be left to float, a completely different thing
    Warning I'm not a teacher

  18. #98
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,766


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    I guess you refer to post #89. There are no pull downs. It was a graphic design error that meant to be a capacitor, as designated by the letter C.

    Ioannis
    Last edited by Ioannis; - 15th January 2024 at 22:16.

  19. #99
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by richard View Post
    the pull down resistor is a bad idea, ...
    Thanks for keeping an eye open for me. It's now removed.

    "Wat waz messa tinking." - Jar Jar
    Not as dumb as yesterday, but stupider than tomorrow!

  20. #100
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    There's a god discussion on Reddit about JLCPCB.

    https://www.reddit.com/r/PCB/comment...than_everyone/


    - I remember a time when Made in Japan was a joke, and then they joined the leaders in electronics.

    - I remember a time when Korean cars was ridiculed, and now they made products that compare or surpass American models.

    - I remember a time when Made in China meant cheap crap that broke easily, and now they are rivaling and even beating some North American PCB fabricators.

    We keep sitting on our laurels while the planet passes us. I really want to encourage local businesses, but it's becoming impossible at these prices.
    Not as dumb as yesterday, but stupider than tomorrow!

  21. #101
    Join Date
    May 2013
    Location
    australia
    Posts
    2,368


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    This cropped up recently on arduino forum as a debounce in noisy [automotive] enviro as an effective debounce method

    Name:  big-debounce.jpg
Views: 40
Size:  15.7 KB
    Warning I'm not a teacher

  22. #102
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Quote Originally Posted by richard View Post
    This cropped up recently on arduino forum as a debounce in noisy [automotive] enviro as an effective debounce method

    Yeah, I've saved an article from February 2020 about this one too:

    https://www.eejournal.com/article/ul...bounce-part-3/


    I had even tried it without success, but I used a breadboard and that most likely caused me a ton of bad connections. This last batch I got from AliExpress leaves a lot to be desired.
    Not as dumb as yesterday, but stupider than tomorrow!

  23. #103
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    The reason why I'm sticking with the Hackaday design is because the front end is recommended by Bourns with their rotary encoders (page 3).

    https://www.bourns.com/docs/Product-...ets/PEC11R.pdf


    I figure if they can recommend this design with their products, it's gotta have some merit when you consider how easily liability lawsuits get thrown around in the US.

    Unless I'm mistaken, the Elliot Williams design from Hackaday that I'm using is exactly the same, but with the Schmitt Trigger added at the back end.


    About that other technique of just storing the state in a bunch of bits, and then checking for a "clean press", Elliot encountered a problem with a "janky button".

    https://hackaday.com/2015/12/10/embe...i/#more-180185
    Not as dumb as yesterday, but stupider than tomorrow!

  24. #104
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,766


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    If a button has serious problem, it has to be replaced.

    The usual, normal behavior of a metal contact switch is to bounce a few ms and then settle. That is why a 10ms debounce is most recommended. More may be better if you can spare the time, either in software or hardware.

    In your case, with so many buttons, you will be using too many components. All these can be just fine be replaced with a few more lines of code for free. And with less posibility for a component or soldering it ot pcb to fail.

    Ioannis

  25. #105
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,542


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    One issue that's been a thorn in my side since day 1 was how to engrave text on the enclosure. One of the easiest ways was to use double-layer ABS engraving sheets like this and engrave text with a mini-CNC or laser:

    https://www.amazon.ca/gp/product/B07QT93LN9/

    My problem was how to have a nice finish along the edges, cause you can see the white backing. I doubt I could get paint to match, and thin moldings would not go on straight. I finally got a breakthrough today; I print my own 1-piece molding, but with alignment pegs.



    In theory I should have a decent enclosure front panel. And best of all, I'm not getting these sheets from Amazon any more, I just got a waaaay better price straight from the manufacturer. And they will cut the sheets to my exact specs, I don't have to trim, so less waste and lower costs.

    And even better, the sales rep said they can customize everything about my order. I can get semi-opaque backing of the colour of my choice. I just slap some LEDs in the enclosure behind the text and VOILA! Instant backlighting.

    This is such a relief. I didn't want my case to look DIY that much; a professional look helps customer confidence in your product.
    Last edited by Demon; - 21st February 2024 at 07:36.
    Not as dumb as yesterday, but stupider than tomorrow!

  26. #106
    Join Date
    Apr 2022
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: New project - MSFS C++ USB interface

    Nice project you have going Demon. I have used this company before at work and have had great results.

    Paul

    Front Panel Creator - Front Panels

Similar Threads

  1. USB interface
    By Frozen001 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th December 2011, 20:37
  2. Host for USB interface?
    By Carrasco in forum Off Topic
    Replies: 4
    Last Post: - 4th August 2007, 00:59
  3. USB Interface using PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 22nd May 2006, 17:04
  4. USB interface from PIC16F877 to PC
    By headshouter in forum USB
    Replies: 0
    Last Post: - 26th February 2006, 05:58
  5. USB project
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 18th January 2005, 22:59

Members who have read this thread : 23

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts