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


+ Reply to Thread
Page 2 of 4 FirstFirst 1234 LastLast
Results 41 to 80 of 154
  1. #41
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Since my favorite I/O Expander MCP23016 is obsolete, I was moving on to the MCP23017. Aaaaaaaand then I noticed they have a bug , and Microchip is leaving it as a feature. The last pin on both ports is output only, and my 1st circuit is all INPUT, bringing me down to 14 I/Os only.

    So I'm moving over to the MCP23S17 and SPI communication. Looks like I'm going to be playing with Gadelhas' code after all.
    https://www.picbasic.co.uk/forum/sho...395#post111395

    Robert

  2. #42
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    I am done with the DIY pcb, chemicals and drilling... Enough fumes, dust and stains!

    A CNC machine is nice to have, for various other uses also, among pcb and drilling, but not for me anymore.

    Now I use the dirty cheap and ultra fast JLCPCB for any pcb needs.

    Ioannis
    I went the chemical way 14 years ago; not doing that again. I had SOIC SMD parts and it worked, but I'm too old to breath fumes.


    This is my 2nd attempt on my mini-CNC. I royally screwed up the mirror operation on the 1st attempt.

    Top:


    Bottom:


    Still need to get fine steel wool to finish the job, dip in silver nitrate, and test text with inkjet printer transfer paper.

    Robert
    Last edited by Demon; - 22nd October 2023 at 00:35.

  3. #43
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    I think the secret to making nice double-sided PCBs on a mini-CNC is to establish a procedure. This is what I do on the mini-CNC:

    Code:
    1. Install 3.175mm drill bit.
    2. Home X, Y and Z axis.
    3. Probe Z-axis.
    4. Drill Left Alignment Holes.
    5. Drill Right Alignment Holes.
    
    6. Install 30deg V-bit.
    7. Probe Z axis.
    8. Height-map PCB, if required.
    9. Route Top layer.
    
    10. Install 0.8mm endmill bit.
    11. Probe Z axis.
    12. Route Top layer Cutout.
    
    13. Flip PCB using Alignment Pins.
    
    14. Install 30deg V-bit.
    15. Probe Z axis.
    16. Route Bottom layer.
    
    17. Install drill bit.
    18. Probe Z axis.
    19. Drill Bottom layer.
    
    ... repeats steps 12 - 14 for all Drill files
    
    20. Install 2 Retention Pins in Screw Holes.
    
    21. Install 0.8mm endmill bit (Make sure drill clears Retention Pins).
    22. Probe Z axis.
    23. Route Bottom layer Cutout.
    I take notes while I'm using the machine, and improve on the process.

    This is what I do to generate the G-code files from FlatCAM:

    Code:
    =========================== FlatCAM ===========================
    
    Start WinPythonPowershell
    
    cd ..
    cd ..
    cd flatcam
    python .\flatcam.py
    
    
    ========== Do Height Map before drilling, if required. ==========
    
    
    	*** do not import Drill file for 3 Fiducials ***
    
    
    ****************** Alignment Holes and Mirror ******************
    
    Generate Drill files and Mirror Bottom:
    	- select MechanicalNofiducial file.
    	- click on 2-Sided.
    	- Axis = X.
    	- Reference = Box.
    
    	- click on Gerber.
    	- Select Bottom layer.
    	- click on Mirror.
    
    	- click on Excelon.
    	- Select Drill file.
    	- click on Mirror.
    	...
    	- repeat for all Drill files.
    
    	- Drill Dia = 3.175mm.
    
    	- point on desired coordinates Upper Left above Outline.
    	- Shift + Left Click.
    	- click Create Excelon Object.
    
    	- point on desired coordinates Upper Right above Outline.
    	- Shift + Left Click.
    	- click Create Excelon Object.
    
    	- select 1st Alignment Hole Drill file.
    	- click Properties.
    	- rename to "1 - Alignment_Holes_L_3.175mm".
    	- click Drilling.
    	- Cut Z = -10.0mm.
    	- Travel Z = 1.0mm.
    	- Feedrate = 25mm/min.
    	- SpindleSpeed = 7500rpm.
    	- Start Z = 1mm.
    	- EndMove Z = 1mm.
    	- EndMove X,Y = 0,0.
    	- Preprocessor = GRBL_11_No_M6.
    	- Click GenerateCNCjob Object.
    
    	- select new Alignment CNC Job.
    	- Save CNC job (include drill dia and side in file name).
    	...
    	- repeat for 2nd Alignment Hole Drill file with:
    	  - "2 - Alignment_Holes_R_3.175mm",
    	  - EndMove Z = 25mm.
    
    	- Save Project.
    
    
    ************************ Milling Layer ************************
    
    Generate Geometry file:
    	- hide all other layers.
    	- select Gerber file for Top layer.
    	- click Properties.
    	- click Isolation Routing - Advanced.
    	- click Calculators, if necessary:
    		- Tip Diameter = 0.1mm
    		- Tip angle = 30deg.
    		- Cut Z = -0.1mm
    		- click Calculate.
    		- Copy Tool Diameter of 0.1536mm.
    	- Paste Tool Diameter.
    	- Shape = C1, circular with 1 flute.
    	- Passes = 2.
    	- Overlap = 20%.
    	- Enable Combine.
    	- Click Generate Geometry.
    
    	- Save Project.
    
    Generate CNC file:
    	- Select Geometry file.
    	- click Properties.
    	- click Milling - Advanced.
    	- Tool Dia = 0.1536mm.
    	- Job = Isolation.
    	- Cut Z = -0.1mm
    	- Travel Z = 1mm.
    	- Feedrate X-Y = 120mm/min - 140mm/min.
    	- Feedrate Z = 10mm/min - 12mm/min.
    	- Spindle Speed = 9500rpm - 12000rpm.
    	- EndMove Z = 25mm.
    	- EndMove X,Y = 0,0.
    	- Preprocessor = GRBL_11_no_M6.
    	- click Generate CNCjob Object.
    	- Save CNC job (include mill shape in file name).
    
    	- Save Project.
    	...
    	- repeat 2 steps for Bottom layer.
    
    
    *************************** Holes ***************************
    
    Generate Drill file:
    	- select excelon file for alignment holes.
    	- click Properties.
    	- click Drilling - Advanced.
    	- Cut Z = -2.0mm (small), -3.0 (large), -10.0 (Retention Pins).
    	- Travel Z = 1.0mm; height above PCB for traveling.
    	- Feedrate = 25mm/min (large) to 40mm/min (small).
    	- SpindleSpeed = 7500rpm.
    	- Start Z = 1mm; height when operation starts.
    	- EndMove Z = 25mm; height to raise after operation.
    	- EndMove X,Y = 0,0; return to origin.
    	- Click GenerateCNCjob Object.
    	- Save CNC job (include drill dia in file name).
    
    	- Save Project.
    
    
    ************************** Cut-out **************************
    
    Generate Geometry file:
    	- hide all other layers.
    	- select Gerber file for MechanicalNofiducial.
    	- click Properties.
    	- click Cutout - Advanced.
    	- Tool Diameter = 0.8mm.
    	- Cut Z = -0.5mm (top layer), -1.3mm (bottom layer).
    	- Passes = 0.10mm.
    	- Margin = 0.
    	- Gaps = None.
    	- Click Generate Geometry.
    
    	- Save Project.
    
    Generate CNC file:
    	- Select Geometry file.
    	- click Properties.
    	- click Milling - Advanced.
    	- Tool Diameter = 0.8mm.
    	- Job = Finishing.
    	- Cut Z = -0.5mm (top layer), -1.3mm (bottom layer).
    	- Multi Depth = enabled, 0.1mm - 0.15mm.
    	- Margin = 0mm.
    	- Gaps = None.
    	- Travel Z = 1mm.
    	- Feedrate X-Y = 100mm/min - 360mm/min.
    	- Feedrate Z = 10mm/min - 30mm/min.
    	- Spindle Speed = 9500rpm - 12000rpm.
    	- EndMove Z = 25mm.
    	- EndMove X,Y = 0,0.
    	- Preprocessor = GRBL_11_no_M6.
    	- click Generate CNCjob Object.
    	- Save CNC job (include endmill shape in file name).
    
    	- Save Project.
    There's been a lot of tweaking and adjusting since day 1. Most of those values are now set as the default values in FlatCAM. I have a lot less room for errors, except in things like trace isolation and PCB cut-outs; I use Milling operation for both of them, but use a V-bit for isolation, and an endmill for cutting out the board. Those 2 bits don't use the same speeds.

    Robert
    Last edited by Demon; - 22nd October 2023 at 01:32.

  4. #44
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Nice PCB, though it needs sanding as you noted.

    The steps to reach your goal will be valuable for a newbie on the field of CNCing a pcb.

    For one off is great. Do you know what is the smallest part you can do with your CNC?

    Ioannis

  5. #45
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    Nice PCB, though it needs sanding as you noted.
    ...
    Do you know what is the smallest part you can do with your CNC?

    Ioannis
    Thanks.

    Well, I know this can handle SOIC easily. I'm sure this could handle SSOP. The only limitation is me; my hands shake a bit now. I got some of that low-melt solder and a new hot-air gun to test some SSOP.

    Last weekend I found out that QCAD doesn't have any means of milling slots; so that meant finding another PCB design software. After 30 minutes of research, I had already decided KiCAD was the one to try first. Reviews on the web gave it very high marks, and deservedly so. Took me only 2 days to get "comfy" with it; I love it, very powerful. I had to redo that circuit above from scratch; which was a good learning experience. It gave me a chance to put the 2 screws in a diagonal arrangement, with 2 headers in the opposite corners for stability.

    I uploaded my new design to JLCPCB for the fun of it; just to get an idea on the upcoming costs. 26mm x 18.5mm, panelized 10 rows x 10 columns (even 100 per sheet), 5 sheets. Check this out, $22 excluding shipping. I'm not even gonna bother shopping elsewhere.


    (updated with the silkscreen, paste and mask files for both sides; turns out that's all included in the price)

    I have 6 of these "switch/pot/encoder adapter circuits", 4 secondary boards (maybe 4" x 6"), and one USB master (that won't be very big). It looks possible to keep that under or close to $10 with JLCPCB.

    Robert
    Last edited by Demon; - 25th October 2023 at 05:22.

  6. #46
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    3D PCB viewer included in KiCAD.



    Wow! :O

  7. #47
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Wow from me too!

    You got all that in a few days? Well, KiCAD will be my next try on PCB software then!

    I use JLCPCB for a long time now and while other competitors may have better quality sometimes, I stick to them because they have DDP option to send in my country. That means I do not have to worry about import taxes and proceedures for this. Love it.

    Ioannis

  8. #48
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    I just noticed JLCPCB only goes down to 0.4mm pin spacing for economic PCBA, and down to 0.35 for standard. PIC 18F25K50 SSOP has 0.2mm between pads, so I guess that means down to SOIC for me.

    Robert

  9. #49
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    I think you are OK since the min pad to pad is 0.127mm and the PIC selected is 0.2mm

    See here: https://jlcpcb.com/capabilities/pcb-capabilities

    Ioannis

  10. #50
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    I think you are OK since the min pad to pad is 0.127mm and the PIC selected is 0.2mm

    Ioannis
    Except I have to be able to solder the prototypes.

    I edited the BOM an PKP files as they instruct to get a better cost estimate for 5 10x10 panels. Over 50% is shipping.

    Have you used their assembly service? I don't see any billing for the actual parts being assembled (Components is blank).

    I have 2 capacitors, 2 resistors, in 1206 SMD format. I didn't see any way of telling them the specs of the components except for the value (my caps are ceramic, resistors are thick film - no mention of voltage, watts, tolerance, etc).


  11. #51
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Ioannis (or anyone else who knows),

    Have you noticed if they care how many holes are in a PCB?

  12. #52
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    This is what you get when you ask for specs from a company on the other side of the world.



  13. #53
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    I have used the assembly twice.

    First time was on a small PCB with 5 or 6 components for 5 pieces. The PCB had a through hole connector that seemed hand soldered. Anyway it was OK all of them and worked fine.

    The second attempt was more complicated PCB with a square PIC and more components (SMD and Through hole). I did a mistake on the selection of LED's. I chose the ones that light from the side and their engineers spotted the mistake, sent me email to explain the problem and the solution, and after I accepted it, I received the 20 pcs that were almost all working fine. One had a cold solder and was easy to fix.

    Right now I am preparing my third order and I see that prices of PIC dropped enough, comparing 5-6 months ago.

    My problem is that they have tons of passive components to choose from many (unknown) suppliers!

    I had similar replies as you Robert about specs or other questions... Yes, communication might be difficult at times. Or most of the times!

    About holes, no. I did not had to count them. There seems no limit or charge on this.

    Ioannis

  14. #54
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    ... One had a cold solder and was easy to fix.
    ...
    My problem is that they have tons of passive components to choose from many (unknown) suppliers!

    I had similar replies as you Robert about specs or other questions... Yes, communication might be difficult at times. Or most of the times!
    ...
    Ioannis
    Ok, so I can't just blindly trust them and slap these into a unit. I have to double-check each piece, cause if there's a problem, I'm the one that's gonna get yelled at.

    Yeah, I suppose I'm gonna have to do a trial run of each circuit at first and measure the devices, then run a battery of destructive tests to see how far I can take them before PUFF the Magic Dragon shows up. Thing is, I doubt we can trust them to always provide the same material unless it's specified and documented somehow. Like capacitors, we could get a batch of 20-25V on the 1st run, then get 10V later on. You can't ask for a remake if it's not documented on the order.

    What if we include it in the BOM, with a message to confirm with us? I mean, it's pretty easy for us to test the voltage and watt limit on capacitors and resistors.

    - maybe extra columns at the end?

    Volts, Tolerance for capacitors.
    Watts, Tolerance for resistors.


    So far, all my communications with Asia has been positive. They use a translator similar to google. When in doubt, always ask for confirmation.

    I had a conversation just this summer with one lady. They're ordinary people just like us; except they're stuck in a dictatorship.

    Robert

  15. #55
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Ioannis, check this out.

    Couple switches, buttons, resistors and LEDs, along with a truckload of holes:




    The exact same circuit without the holes:




    I guess they've moved away from milling the boards with endmills, but have moved on to waterjet (this is my first guess) or laser.

    This is great news for me 'cause I'm going to need a lot of holes.
    Last edited by Demon; - 29th October 2023 at 02:09.

  16. #56
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

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

    About the components, there are tons of them but each has specific code from their sister company https://www.lcsc.com/ where you can login with Jlcpcb credentials.

    When you find the component you are happy with, put the code in the appropriate BOM that will accompany your PCB files.

    Or you can use their EasyEDA and all these done almost automatically because the components library of this cad has all the codes and makes it easy to produce BOM.

    There are also FAQ files if you are in doubt and also BOM example files on the FAQ section, https://jlcpcb.com/help/

    My last job was done in Eagle and then, with the help of the CAM file JLCPCB offers, I exported the gerber files for PCB production along with the BOM file. I can send them to you if you want to see how I done it.

    About the quality of assembly, I can say that you cannot beat them. Even if I had one cold joint, it was nothing considering the work needed on my side to assembly by hand 20 PCBs by hand! A nightmare for sure!

    Ioannis
    Last edited by Ioannis; - 30th October 2023 at 08:56.

  17. #57
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Figured I'd draw myself a logo from the start. Demon was my online racing name for over 20 years in the NASCAR Racing Series from Papyrus.

    I got these from the DreamStudio AI image generator. I took the one from the bottom left and started tweaking it.

    Name:  Collage.png
Views: 114
Size:  889.6 KB


    The fine lines looked like crap once imported and shrunk in Kicad. So I used a LED tablet as backlight and traced it.

    Name:  4 - Screaming Demon by hand.jpg
Views: 109
Size:  155.6 KB


    I added:
    - nose from snapping turtle,
    - teeth from viper,
    - tweaked the ear,
    - horns from a bull,
    - lower jaw from "I am legend".

    The nice thing with the image converter in Kicad, it removes the pixelation along the edges (used windows PaintBrush for cleaning up). It may not be professional, but it's unique.

    Name:  7 - Screaming Demon final.png
Views: 108
Size:  51.0 KB
    Last edited by Demon; - 7th January 2024 at 21:37.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  18. #58
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Tweaked some stuff, but I could touch this up forever and I'd still find something.

    Name:  7 - Screaming Demon final.png
Views: 91
Size:  70.0 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  19. #59
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    I think you are OK since the min pad to pad is 0.127mm and the PIC selected is 0.2mm

    See here: https://jlcpcb.com/capabilities/pcb-capabilities

    Ioannis

    I've been playing with their online quote, and I noticed some irregularities when you get a quote on way, then backtrack and do it another (like with and without assembly, or when you change from single boards to panels). It seemed as though they forget to reset some variable and I got different prices.

    So I got in the habit of always starting from step 1, and submitting the starting ZIP file. That way I had more predictable results.

    Overall though, it is EXTREMELY economical to print with them. My small board costs me $100 CAD for 500 with shipping including assembly of 2 SMD resistors and 1 SMD capacitors. That's $0.20 each; making my own PCB boards is not even close to worth it.

    I'm going to solder the switches/buttons/rotary switches/rotary encoders as well as the JST XH connectors to start. I'll see about the PIC MCUs main board later; gotta start somewhere.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  20. #60
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    I noticed that also. Some settings are revert to default so, yeah. Prices are not same.

    Regarding assembly, for passivess like resistors and capacitors, you have so many to choose and the possibility to select one that is out of stock is too high! Also most of the brands are unknown to me with so many parameters to check. But the prices are in either case low.

    On the other hand for MCUs, things are not so nice about prices or stock.

    For 10 or 20pcs I did not bother and paid the extra money to have a PIC16F assembled.

    Ioannis

  21. #61
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    I noticed that also. ...

    For 10 or 20pcs I did not bother and paid the extra money to have a PIC16F assembled.

    Ioannis

    Good, I was hoping I wasn't seeing things the other night.

    Yeah, that liquid solder paste and an air gun is changing the game. It's a lot less complicated for shaky hands like me to solder tiny MCU legs.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  22. #62
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    You really have to go through the entire estimate process to get the actual shipping fee, as well as customs and taxes. In the sample I tried, it went from $0.15 each to $0.30ish each.

    I'm using clean ($2.10) and de-panel ($4.19) as well, that way boards should be relatively ready to use when they arrive. These fees were the same whether I did 3x3 or 10x10 panels (I didn't change the quantity, these were for 5 panels, I assume it'll increase for more panels).

    It's kinda cool how they maintain an update of the entire production process. I made a small order of 5 units of single boards, just to learn how things work from A to Z. My real order will most likely be for 5 of 10x10.

    Name:  JLCPCB fabrication progress.png
Views: 87
Size:  30.8 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  23. #63
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Yes, it is very impressive the workflow!

    Ioannis

  24. #64
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    It would figure that the very next day that I send my order, I find an even better way to debounce pushbutton switches using 74HC14 ICs. I hadn't seen this one before. I had only seen the RC design. Oh well, live and learn.

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


    About not knowing which brand or specs of components used by JLCPCB; I scan their database for components IN STOCK using search parameters like RESISTOR 1206 10K 250MW then sort their output on descending price.

    https://jlcpcb.com/parts/all-electronic-components


    I looked for a known brand and picked their component with the lowest tolerance percentage; I used Yageo for this project (mainly cause it's the only one that I recognized).
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  25. #65
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Many MCU now have implemented schmitt trigger on their inputs. Maybe this helps ditch the extra chip?

    Also software debounce costs nothing but little time to program, right?

    Ioannis

  26. #66
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Thing is, my buttons leads to I/O expenders, and then all the I/O expanders to the MCU. They first IOE I looked at didn't have schmitt triggers on all inputs.

    And honestly, I really preferred to limit extra processing on the MCU and concentrate on USB, and servicing the IOEs. I didn't feel like adding logic for debouncing if at all possible.

    The 74HC14 may cost a few pennies, but it should help clean up the signals to the IOEs.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  27. #67
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Well, I understand the case. With the I/O expanders things are different.

    A very good debouncer is desribed in the second part of the article you post. Really neat and ultra fast technique with very low MCU load.

    https://hackaday.com/2015/12/10/embe...ttons-part-ii/

    But amazing things can a capacitor do! In most cases, with relatively good switch, a series resistor from the switch to the input and a small increase in the capacitor, that is in parallel with the input to the ground, is enough. Used that many times and with rotary encoders too with great results.

    The secret is to use that resistor R1 in the following design, to "isolate" a bit the switch from the capacitor.

    Name:  debounce-sch.jpg
Views: 74
Size:  34.9 KB

    Ioannis
    Last edited by Ioannis; - 12th January 2024 at 08:09.

  28. #68
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    That software technique of using the last status of the pin (01111111) looks nice on paper, except I'm going to have nearly 100 "controls" (pushbuttons, rotary switches, rotary encoders and rotary potentiometers) on this basic project. And future versions of this project is going to have a truckload more. That's why I'm trying to stay on hardware solutions if at all possible.

    I put in 3 orders to JLCPCB so far. Really looking forward to see the end result in person.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  29. #69
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    Wow from me too!

    You got all that in a few days? Well, KiCAD will be my next try on PCB software then!...

    Ioannis

    I can't say enough good about KiCad. It even has SPICE, but I never got to learning exactly how to use that.

    I can generate all the files for a new circuit within a few hours. I can't imagine not working with it now. I love the Electrical Rules Checker; that saves a ton of time, money and effort.

    It takes a while to get used to some of its way of doing things. There's a LOT of information on the web for any error I encountered; like having to add a PWR_FLAG to VDD and GND lines, and how symbols can be divided into units).

    Units are essentially individual layers for components with multiple functions, like a 74HC14 chip with 6 circuits and the power circuit. In this example, I use only 4 of the 6 circuits. I'm putting the decoupling caps near the pin on the MCU (it's a separate circuit).

    Name:  KiCAD units.png
Views: 78
Size:  141.2 KB

    And best of all, it's free.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  30. #70
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Why is the PWR_FLAG necessary to be added? Isn't +5V enough?

    Ioannis

  31. #71
    Join Date
    Aug 2011
    Posts
    412


    Did you find this post helpful? Yes | No

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

    You shouldn't leave the inputs of the HC14 floating... the outputs will be unknown.

    Also, an ST gate really won't debounce anything if that's what you're trying to do.

  32. #72
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Yes, inputs should not be in the air.

    Also despite being ST inputs, the resistor and a cap should still be added. Tubleweed is very right about that.

    Ioannis

  33. #73
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by Ioannis View Post
    Why is the PWR_FLAG necessary to be added? Isn't +5V enough?

    Ioannis

    In order for KiCad to be able to test the circuit, it has to know where the current is coming from. I just noticed how one dude uses a tiny legend to connect the flag with VDD and GND. You only need to connect the flag on each once.

    https://forum.kicad.info/t/erc-error...nd-gnd/39364/5
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  34. #74
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    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.
    ....
    I wish I had seen that before sending that order to JLCPCB. I'm gonna have a resistor jumper on my brand spanking new circuit (only printed 5 to test).

    Name:  74HC14 input.png
Views: 72
Size:  686.1 KB


    Quote Originally Posted by tumbleweed View Post
    ...
    Also, an ST gate really won't debounce anything if that's what you're trying to do.
    I'm trying to get a cleaner signal like he explains here at "Hysteresis: The Full Fix".

    Are you saying this doesn't work as he explained?

    https://hackaday.com/2015/12/09/embe...uttons-part-i/
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  35. #75
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    It will work if you included the RC network also. But NOT as in your post #69, where switch go directly to the HC14 input.

    Ioannis

  36. #76
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    I really shouldn't work until the wee hours in the morning. That rotary switch circuit was totally not finished.

    I've updated my pushbutton circuit.

    Name:  Circuit B3F-4055 w 74HC14.png
Views: 68
Size:  52.2 KB


    And my rotary switch circuit. (CORRECTED VERSION IN NEXT POST)

    Name:  Circuit SR25 SP4T w 74HC14.png
Views: 68
Size:  97.5 KB


    1. Do you see any other mistakes?

    2. Do I still need a cap at the MCU pin when it's a signal from a 74HC14?



    EDIT: Hmmm, just noticed my pull-ups on the rotary switch are between the 10K and 74HC14. Gonna go change that.

    Thanks!
    Last edited by Demon; - 13th January 2024 at 23:19.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  37. #77
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Here's my corrected rotary switch with corrected pull-ups.

    Name:  Circuit SR25 SP4T w 74HC14 corrected.png
Views: 68
Size:  82.1 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  38. #78
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

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

    Well, better but not perfect I suspect.

    The HC14 inputs are at High (~5V) level when not triggerd by the switch/encoder.

    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

  39. #79


    Did you find this post helpful? Yes | No

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

    Couldn't you knock out all the stuff, Schmitt ic, r's, c's ...... and just use 1pause for say 2 milliseconds when check switch....... check sw-if change or if zero- pause 2 ( or 3 or 5 milliseconds) check again..... very simple routine ?

  40. #80
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by amgen View Post
    Couldn't you knock out all the stuff, Schmitt ic, r's, c's ...... and just use 1pause for say 2 milliseconds when check switch....... check sw-if change or if zero- pause 2 ( or 3 or 5 milliseconds) check again..... very simple routine ?

    For a small project, yes.

    But I'm using I/O Expanders to relay the signals to a USB PIC. I don't think USB will like pauses, I'd have to start a timer or something to check later for signal change. But then I'm going to have nearly 100 of these signals to manage. That's why I want to use hardware as much as possible.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

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

Members who have read this thread : 25

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