PDA

View Full Version : New project - MSFS C++ USB interface



Demon
- 24th April 2023, 03:24
My new project is slowly taking shape; all the buttons, knobs and switches for a Cessna 152 in MicroSoft Flight Sim 2020.

https://i.imgur.com/x5nXw70.png

That was using a utility to get to Lvars, but I can't use it for all my objectives. It doesn't look like much, but I had to get familiar with Visual Studio 2022, learn C++ and get familiar with SimConnect.

I've since moved on to my own standalone Windows GUI in C++. I can finally get to the SimConnect Events, SimVars as well as those dreaded Lvars.

https://i.imgur.com/IVGVNj9.png

I can get to all the FlightSim controls via my program. Now I have to get the USB communication going between a 18F4550 and my program.

Robert
:)

Ioannis
- 24th April 2023, 20:05
I can only say WOW! In a sort time you did miracles Robert!

Ioannis

Demon
- 26th April 2023, 23:16
I can only say WOW! In a sort time you did miracles Robert!

Ioannis

On the down side, I have to buy a new motorcycle helmet...

9372

Ioannis
- 29th April 2023, 20:44
:)

I feel you!

Ioannis

Demon
- 15th May 2023, 21:08
Looking forward to your progressing on this.

Ioannis

Ok, well here's an update for you. :D


First I've learned that MS FS buttons and switches are spread over 3 types of data: events, variables and Lvars. I got to get familiar with C++, I can get to events and variables using one "technology", or I can get to Lvars using another, but I can't mix both. I kept reading comments on forums about "just use the SDK also for the Lvars", except I never saw examples.

So after a gazillion attempts at using the SDK to get to the Lvars (I can get to the events and variables just fine), I finally find the SDK support forum and post there. DING! I get a really quick reply to "just do this, it'S in the docs". Yeah, sure, the instructions were crystal clear, but there was a bug in the sample code, and that's exactly what I had been using blindly. :D

I eventualy gave up, read the instructions word by word, cross-checking against the sample code word-by-word, and it struck me, a variable was missing. Damn! I don't wanna say how long it took me to find that, it's embarassing. But hey, at least the Dev didn't know there was a bug in the sample either.


Then, got the PICkit 4, spent a ridiculous amount of time to get it working, but it's still not quite right. Turns out I found my U2 USB programmer and it works just fine, in fact, it's faster than the PK4. So the PK4 is going into a TO-DO-ONE-DAY drawer...

Been setting up a room into a small shop, putting up all my cabinets and stuff. Turns out I really need to make an inventory system caause now I'm ordering parts I already have, somewhere, that I find the very next day a shipment comes in from DigiKey.

My Aoyue 738 soldering station crapped out; the bits weren't heating at the very tip, even brand new ones. Wasted too much time on that too, gave up and got a Weller WE1010NA from Amazon. Looks decent, haven't tried it much yet except turning on and seeing how fast it heats; real heavy transformer, digital display, comfy non-slip tool that can't fall out the holder (like my antique Weller), and heats super fast.


EasyHID generated obsolete VB6 code, and of course I can't find my VB6 Development CDs. You can't just slap VB6 code into VS2022, so I paid the money and got an upgrade to HIDmaker FS2 cause it seemed to be the answer to my prayers; it can generate PBP3, and .Net C++ WinForm code. Turns out WinForms isn't what I wanted, I just ran off in the wrong direction with that. :D

Buried in the documentation for the MS FS SDK, there's this requirement:

"To build SimConnect add-ons, the recommended Visual Studio version is Visual Studio 2019, with a minimum version of 2005. To build the project, make sure you have completed the following steps.

For out-of-process applications, start a new Console Application project if the add-on will have no user interface. Start a new MFC Application if the add-on will have a user interface. In either case, set the platform as x64. In order to use the SimConnect functionality, it is required to include the SimConnect.h header file."

Now to me, I saw Visual Studio, and figured VS2022 would work just fine. Turns out, there's more to those requirements than just a need for 64-bit compiling. I had totally forgotten about that MFC part, mainly cause it meant absolutely nothing to me when I read it earlier this year, and started generating C++ WinForms code. Turns out, that was wrong.


So now I'm generating C++ MFC code, but there's a problem, I only notice now that it's generating in Win32 code (x86), and I need Win64 (x64). So I google, and learn to convert from Win32 to x64 straight from inside VS2022, except it ain't that simple, there's an error generated....

And that's where I am today; overcame a truckload of hurdles, learned a bunch of new stuff, got a better idea of what I need and where I'm going. But I don't know enough about Windows to convert, so I'm waiting for support from HIDmaker to guide me along (no complaints about support, he's a one-man show as far as I know, and I have ZERO complaint).

But I will say this, when I compile the PIC code in the 18F4550 on my Lab X1 while the PIC is connected to my PC, DING! The new device is detected instantly; that is such a reassuring sound that I hadn't heard in a long time. Switch over to VS2022, compile the C++ code and Tadaa! The darn thing works, except it's in Win32.

I just have to figure that part out, and then I can start testing against MS FS.

Robert
"Yes, I'm bored cause I'm sitting on my thumbs, instead of going outside to mow the lawn like I'm supposed to before I lose a dog in there"

Demon
- 15th May 2023, 21:18
How to tailor that Windows form to my needs is another problem. It's not the standard super-simple GUI with text boxes and buttons. It uses a formatted Windows system that I'm not familiar with. That's another thing I have to muddle through.

Like this:

9406

mpgmike
- 16th May 2023, 02:02
I have Visual Studio Pro 2015 (paid), VS 2017 Community (free), and VS 2022 Community on my computer. I've noticed many of the YouTube tutorials are using 2017, even though it is 2 versions old. Even though I loaded VS 2022, I have yet to play with it. I have, however, started using the free VS 2017 which does things my Pro VS 2015 cannot.

Demon
- 16th May 2023, 02:58
Actually, it creates the main window, and splashes a familiar sub-window if I'm not connected. As soon as I'm recognized, that pop-up disappears, looked through the code and haven't found it yet.

9407

I have figured out that the "main window" is controlled by Manifest in the project Configuration properties and the Resource file. Gotta google to learn more, never touched that stuff before.

Robert

mpgmike
- 16th May 2023, 17:03
I'm still in limbo without access to my other laptop, but I modified the code so that if I wanted to debug the VB side without actually connecting, I would click "Cancel" and a new pop-up (which I created) would ask if I wanted to work off-line. I remember what I modified was one of the HIDmaker main page routines near the top having to do with On Opening or On Connect or something like that. Look for the code that includes the pop-up and start there.

Demon
- 16th May 2023, 19:03
I'm still in limbo without access to my other laptop, but I modified the code so that if I wanted to debug the VB side without actually connecting, I would click "Cancel" and a new pop-up (which I created) would ask if I wanted to work off-line. I remember what I modified was one of the HIDmaker main page routines near the top having to do with On Opening or On Connect or something like that. Look for the code that includes the pop-up and start there.

Will do.

Also going to google how to call a 64-bit program from a 32-bit and exchange data (never done that). I fear asking Dr. Miller to generate C++ MFC in x64 is not a simple task at all. There's a hell of a lot of code generate, it's not just descriptors, constants and variables. There's a lot of USB manipulation going on as well.

Robert

Demon
- 16th May 2023, 22:25
...
So now I'm generating C++ MFC code, but there's a problem, I only notice now that it's generating in Win32 code (x86), and I need Win64 (x64). So I google, and learn to convert from Win32 to x64 straight from inside VS2022, except it ain't that simple, there's an error generated....

And that's where I am today; overcame a truckload of hurdles, learned a bunch of new stuff, got a better idea of what I need and where I'm going. But I don't know enough about Windows to convert, so I'm waiting for support from HIDmaker to guide me along (no complaints about support, he's a one-man show as far as I know, and I have ZERO complaint).
...

Holy moly, talk about a rabbit hole, searching for "communicating between x86 and x64 C++ programs". :D

I've narrowed it down to IPC Shared Memory using Boost (staying away from pipes, sockets, RPCs and what-nots). It's been used successfully by a lot of programmers.
https://www.boost.org/doc/libs/1_82_0/doc/html/interprocess/sharedmemorybetweenprocesses.html

This guy got it working:
https://stackoverflow.com/questions/18533527/boostinterprocess-shared-memory-between-32-and-64-bit-processes/63224381#63224381

So far, BOOST has come up the most in the threads I've gone through. Now I just have to find a really basic working code. Usually it's just bits and pieces here and there, just enough to get me all excited, but not enough to compile without knowing things like "how to adapt code to your needs without having had a C++ course in your life". :D

But at least I have an option if HIDmaker can't be adpated to x64 in the near future. It just adds a layer of complexity I could do without.

Robert


EDIT: So how fast can data be transferred using IPC shared memory?

9415

And this is on a Pentium 4, I'm running something slightly faster with a bit more RAM. :D

I was planning on sharing about that volume of bytes too, 1 or 2 K.

Demon
- 17th May 2023, 04:19
Step 1, made 2 identical programs in 32 and 64 bits, that turn the light ON/OFF only on their side.

9416


Step 2, get them to turn ON/OFF both sides.

... insert cool pic here on soonday ...

Robert
:)

Demon
- 18th May 2023, 22:48
Wow, talk about a roller-coaster (memory getting fuzzy now about exact sequence):

- back in early 2023, I get a basic C++ WinForm GUI running with MSFS SDK, not even knowing what type of program I create (from youtube video).

- decide on upgrading to HIDmaker FS2 to generate PIC and C++ USB code.

- generate USB C++ code, I chose C++ MFC cause I recently saw that in the MSFS SDK docs, compile in x86 ok.

- compile in x64, cause I just saw that again in the MSFS SDK docs, compile failed!

- google migrating C++ x86 to x64, looks like the apocalypse to me.

- figure I'll make a x64 program between the x86 C++ code and the MSFS SDK code.

- start googling, quickly narrow in on Inter Process Communication.- eventually IPC Shared Memory between x86 and x64 stands above the crowd.

- turns out the BOOST group have been working on that, some programmers report success, but never sharing a complete sample.

- I try it using the sample from Boost.org, fail miserably, so I made a rather lengthy post on Stack Overflow asking for help.

- as backup, I find out Adontec produces exactly what I need, just for $400USD, sent then a message to confirm it'll work under my criteria.

- as I'm reviewing the MSFS SDK docs, I notice they say x64 MFC app if you're interfacing "directly" with MSFS, but you can use an ordinary console app if you don't.

- Nothing to lose, so I switch back to C++ Winform, turns out I'm not, I'm just playing with a DLL.

- generate the C++ x86, then compile using x64, and BOOM! The darn thing compiled.


So yeah, been an up-and-down last few days. Hopefully things keep going my way.

Robert
:)

"just a blind man running with a huge smile on his face!"

Ioannis
- 19th May 2023, 10:53
Seems you are very persistent person! And wow, you did an amazing trip through all these environments...!

Respect from me.

Ioannis

Demon
- 19th May 2023, 21:15
I prefer the term "obnoxiously stubborn and willfully oblivious". :D

Note to future-self, ALWAYS put the Windows INCLUDE at the top of the list. Argh, the multitude of insane errors and hours of google searches...


Status of the day; didn't get as far as I planned with that stupid include problem, but I did get to compile the generated code with USB components in 64-bits, and connect to MSFS, that last part was my do-or-die moment of the day. :D

9417

EDIT: Oh yeah, the single button in the interface works fine; changing between a 0 and a 1 when I press a button on the Lab-X1. Haven't implemented anything else yet.

Demon
- 19th May 2023, 23:02
Men can find joy from the simplest things.

Landing light ON-OFF from the Lab-X1 via USB.

9418

Robert
:)

Ioannis
- 20th May 2023, 09:47
Men can find joy from the simplest things.

Landing light ON-OFF from the Lab-X1 via USB.

Oh, yeah! I understand that feeling... Especially after the long trip to finally manage that damn thing to flip!

Ioannis

Demon
- 21st May 2023, 18:07
YAY! I can finally detect a change in Engine RPM. And this is why I absolutely wanted to have Code Debugging working.

9419

Now I just have to learn how to use structures and variables in C++. :D I kept trying to peek at that data, but I just couldn't get to see anything meaningful.

Good thing we have google tutorials. Worse case, I'll ask on the Dev forums, but I want to try to get there on my own.

Robert
:)

Ioannis
- 21st May 2023, 19:43
You did all that in C++ with no knowledge of structures and variables?

For me C was difficult when I tried to learn and then C++ was 10 fold worse...

Well, I have to try again I guess.

Well done Robert.

Ioannis

Demon
- 21st May 2023, 23:59
Thanks. Yup, tried C For Dummies 20+ years ago and got nowhere fast.

I'll refer you one youtube video later. The dude speaks clearly, and in no time you have a basic window with buttons and stuff.

Best part, Visual Studio 2022 Community is free. It's way better than what we had for Visual Basic way back when.

Demon
- 22nd May 2023, 05:18
Here, download and install VS2022 Community. It's free.

Then follow his instructions to the letter. You have a simple Windows form in no time.
https://www.youtube.com/watch?v=zv8DkkhBNR0

Ioannis
- 22nd May 2023, 12:17
Thanks for the link.

Ioannis

Demon
- 22nd May 2023, 23:11
It's so frustrating. "Experts" on forums assume you know C++ nearly as much as they do, or point to sample code that is exactly like what you've already put together, or say "hey, just use this conversion routine" - except that routine doesn't work against that sort of variable.

9421

I'm so close, I can see the data in the structure and it matches what's displayed on the instrument panel. I guess I'm off to "C++ structure tutorials" in hope of finding something useful.

Robert
:(

Demon
- 23rd May 2023, 00:20
Argh, it's like extracting teeth; slow and painful. Thanks to google I was able to "address" the structure element properly and copy it into a double variable.

9422

I may have got just a tad smarter by learning this, but I just moved the problem into another pile; I can't seem to be able to do anything with a double variable. Can't display it on screen, can't convert it to a string; I tried but commented out the attempts to keep track of what I did.

Robert
"At least I'm not going backwards."

Demon
- 23rd May 2023, 00:38
WOOT!

It helps when you know what questions to ask google, AND you get very well-explained pages.

9423

Now I have to return that value to the PIC, but in the meantime, I'm getting a beer.

Robert
:)

EDIT: Hmmm, maybe I don't deserve that beer yet. There's a 15 second lag before throttle changes are reflected in my app. I'm hoping it's because I used "option 2" on how you can poll SimConnect for variables; it also contains the USB code (not sure yet if that can impact the SimConnect logic).

Really hoping "option 1" works as promised by the Devs (it's a callback routine, not my type of code, but hey, if it works as promised).

mpgmike
- 23rd May 2023, 01:12
About 7 years ago I decided to get serious about Visual Basic (as opposed to C++) and bought 5 different books on the subject. I'm an old fart (56) and still like paper books. At any rate, about 90% of what I need to know is somewhere in at least 1 of those books. Occasionally I have to jump on YouTube for answers, but the books really helped me. Just sharing my experience.

Demon
- 24th May 2023, 02:44
Yup, we should be able to find an answer to a question on just about any software issue today. Oddly, I'm starting to notice a trend of websites posting "relevant information" without going into the exact answer. I'm starting to think that web traffic (money for ads) is starting to dilute our source of information. And then the forums of egos arguing with each other, and not one of them give a complete code answer to the original question. It's taking a surprising amount of times on some issues; like the sheer volume of C# links popping up for C++ searches; driving me bananas.

I had a serious lag issue with my USB generated code when I'd read variables from the MSFS SDK. So I started a new program from scratch, no USB, made just to read the Engine RPM and nothing else. Then I compared it with SimVar Watcher; it's the tool distributed along with the SDK to doublecheck our work. Turns out I had to add a delay feature to run beside SVW at full speed (I got extra practice on string manipulations and tweaking a Timer on the fly, so not a waste of time).

This is with a 1ms delay timer on my program during max acceleration:

9424


I had to slow down to 5ms to be right at the same speed as SVW also during max accel:

9425


So I'm happy. At least I know that now I can run at an acceptable rate of speed. I have a theory why my code bogged down before, need to do another test.

Robert
:)

Demon
- 24th May 2023, 03:45
Hot diggity dog! It's even better than I thought under real conditions.

I could slow my program to 6ms even after adding USB and I'm still updating as fast as SimVar Watcher.

9426

Problem was simple. I was piggy-backing my reads to the MSFS SDK on top of the USB Timer. I added a separate Timer (like I practiced in the previous post), and away it went.

Freaking awesome! Another major hurdle, but the worst is tomorrow. I have to mow the lawn, badly...

Robert
"Darn tootin' right that I'm happy!"
:D

Demon
- 24th May 2023, 03:56
Not bad considering 4 days ago I was "pushing a button".

9427

Robert
:D

Demon
- 24th May 2023, 20:28
One possible issue has been bugging me for a few days; my SimVar tests were all done with only a single variable. I wasn't sure if the code I was using could support multiple variables.

Added the markers and both Kohlsman settings; the ADF frequency still isn't completely converted (gotta play with BCD, never done that), and bumped up my delay to 10ms. I'm still faster than SimVar Watcher under full throttle acceleration.

9428

I'd go mow the lawn in celebration, but it rained; I'd need a tractor to cut wet grass. Major relief; go I guess I'm finally getting that beer. :D

Robert


EDIT: Turns out I might be even a tad faster. I forgot something from the original code. :D

9429

Demon
- 26th May 2023, 03:22
I spent the day fleshing out the Form with all the variables to be Read from Flight Sim on the left, and all the controls to be sent up from the PIC on the right. I run SimVar Watcher just to be sure I'm still on par on engine RPM reads during full throttle acceleration.

There's no added logic behind these new fields, it's just typing them in, lining them up in a meaningful manner, and compiling to make sure there's no serious typos. These fields aren't meant to stay visible; I'm gonna hide them once development is finished. I'd rather have them in the background ready to be reactivated if I have problems. The only thing expected to remain visible is that "Connect to Flight Sim" button and textbox.

9430


I did get to finish the conversion technique on that darned ADF Frequency earlier today. Check the number displayed at the top on the instrument panel, then compare it to the number stored in Flight Sim on the left. :D I did BinaryCodedDecimal conversions back in college; that was in late 70ies, never touched that since. LOL

9431


Nothing spectacular, got the bottom subroutine off google, figured out all the BCD32 manipulations after 1 good video on nibbles.

9432


I keep thinking the worst is behind me; and then another day starts.

Robert
:)

Demon
- 28th May 2023, 06:38
Those guys that maintain the Flight Sim SDK docs like to keep us on our toes. There's another error; the Transponder code is stored in Binary-To-Octal16, not in Binary-To-Decimal16; totally not the same thing. Took me a while to figure this one out.

There's a design flaw in how the let us read COM frequencies; they drop that 3rd digit on the right. I have yet to see a way to "deduce" what it can be. So Plan B it is: I'm not gonna Read the Com frequencies, I'm gonna Tell Flight Sim what they are; case closed. :D

9433

And I'm still only scratching the surface of this project.

Robert
:)

Demon
- 15th July 2023, 17:53
I really enjoy programming, and now even more so cause I hate being a buyer. Looking for an item, getting to field the same questions; comparing prices, it's so tedious. Really happy I know how to use a spreadsheet. And I have to be careful not to give wrong specs, I keep copy-paste of a lot of my replies. I've been doing supplier research for over 2 weeks now, and I'm royally fed up with this part of the project.

I've been moving "my stuff" from a small room to half my basement; you know, that part of the house that you accumulate garbage over 30 years and 3 kids. :D Well I've cleaned up nearly 1/2 of my new area; PC and printer is back up and running. I didn't even take the time to paint the cement floor, or finish the gyproc walls; I've spent enough time moving my daughter in, then back out a few days later. :/

I've got most of my shelves and storage bins set up, but I don't have a soldering workspace up yet and that really bugs me. I'm taking a bit of time to make a special area for the 3D printer, a secondary PC and my pet project; a custom CNC machine to fabricate PCB boards, plastic parts, that sort of thing.

The cost of PCB boards is just insane now; even tiny ones. I figure I'll cover the cost fabricating my own milling machine with this first model. I don't need anything fancy; just X, Y and Z axis for now. I know I'll want pick-and-place one day, same with an automated tool changer, but those things can wait.

It's nice to be able to test designs soooooo much faster. It won't be as nice a professional PCBs, but I know it'll work for a fraction of the cost. Darn, even if I go back to chemical etching, it's still cheaper and faster than waiting 1 week for the DigiKey special offer.

I was getting "good enough" at PCB fabrication too; and this time I have a LOT of space to set myself up properly. Like install my own kitchen vent that evacuates fumes outside, instead of working on the kitchen stove. I can use that for a tiny paintbooth as well. And there's been progress in the DIY PCB fabrication world; guys are now finishing their boards green (that has to be cheaper and less "fumy" than the silver coating I was dipping mine in, some even doing silkscreen.

Only downside, I had to disassemble my pool table. ;(

Robert

Ioannis
- 17th July 2023, 08:01
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

Demon
- 22nd July 2023, 02:27
I'm gonna check out JLCPCB once I have a circuit ready.

Right now I'm finishing up buying parts; just need those rocker switches and some graphic overlay for backlit text.

On the positive side, I'm well on my way repossessing my basement from all that junk I've accumulated. :D

Finally got to work on my new workbench debugging why that LED wasn't turning on as it should.

Robert


https://youtu.be/610FhM0tFBA

Demon
- 23rd July 2023, 19:00
I'm a visual person, I like to see what I'm doing as opposed to relying exclusively on drawings and schematics (although I do enjoy making them).


This is what I'm doing right now; the communication & navigation panel (COM1, COM2, NAV1 and NAV2).

https://i.imgur.com/DPjJer4.png


This is a quick layout of the parts I've bought (that's about 9 inches wide, 8 inches tall).

https://i.imgur.com/wnabnU4.jpg


The TEST button was integrated in the volume button in-game. I couldn't afford potentiometers with a push-button, so I added a separate black button

The rotary encoders I'm using to change frequency have a built-in push-button switch; that way I don't need a dual knob arrangement (again, more expensive).

Yeah, those squiggly pink circles will be LEDs later in life.

Robert

Ioannis
- 24th July 2023, 13:19
All these pots, displays, switches etc, will be inerfaced to PIC microcontrollers and then to the PC running the simulator?

Ioannis

Demon
- 25th July 2023, 02:38
All these pots, displays, switches etc, will be inerfaced to PIC microcontrollers and then to the PC running the simulator?

Ioannis

That's the plan.
🙃

Ioannis
- 25th July 2023, 13:18
Wish I was closer to your location. An amazing project this will be!

Ioannis

Demon
- 14th October 2023, 07:00
I've been up to my eyeballs with little time to browse the forum. I've been researching parts, accumulating inventory, learning C++ and the MS Flight Sim SDK, and now XML, finding decent software to convert Gerber RS-274-X to G-code (turns out my Gerber format is obsolete, but the dude modified his software for me).

I've settled on all the controls for my console, and have all the variables and events to interface with the MSFS SDK. Cost forced me to make a compromise for this first model (targeting budget gamers); I've removed all gauges and displays and moved over to on-screen in-game XML gauges. So I'm back to a "button box" design. That lower screen is all the XML gauges I will be using; some downloaded, some tweaked, and some my own.
https://i.imgur.com/TwzSnCv.png

I've just starting designing my first "real" circuits; hoping to machine them real soon (I've done basic router and drilling on the mini-CNC). So far I'm seeing about 0.001" to 0.002" vertical tolerance on 3/4 of the bed, with a slight warp in one corner moving up to 0.005". That could be anything on a budget machine; bed, bearings, rails, tidal forces.

And of course I see StarField is about to launch on kickstarter on the 18th; 25μm XY precision, 350x200x350 resin 3D printer. My SLA 3D printer is ok, but I wouldn't print ABS on it and prints are gonna need a LOT of hand-finishing, then I have to mold cases (not a simple process). With a resin printer, I could go straight to ABS finished cases, removing a LOT of steps in my fabrication process, and removing all the costs with mold-making (need to get a vacuum chamber).

Hoping to have nice pics of PCBs to share soon.

Robert

Demon
- 14th October 2023, 22:52
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/showthread.php/16066-MCP23S17-Three-different-approaches-ShiftIn-ShiftOut-MSSP-PBP-MSSP-ASM?p=111395#post111395

Robert
:)

Demon
- 22nd October 2023, 00:30
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.
https://www.youtube.com/watch?v=RtQNCvaSiY4

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

Top:
https://i.imgur.com/ikeGuLD.jpg

Bottom:
https://i.imgur.com/Qi9NArn.jpg

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

Robert

Demon
- 22nd October 2023, 01:29
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:


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:


=========================== 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

Ioannis
- 22nd October 2023, 13:35
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

Demon
- 25th October 2023, 04:23
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.

https://i.imgur.com/y4Klgug.png
(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

Demon
- 25th October 2023, 05:36
3D PCB viewer included in KiCAD.

https://i.imgur.com/dzrEKlQ.png

Wow! :O

Ioannis
- 25th October 2023, 06:55
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

Demon
- 28th October 2023, 01:44
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

Ioannis
- 28th October 2023, 12:51
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

Demon
- 28th October 2023, 17:14
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. :D

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

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).

https://i.imgur.com/Ir7IEyD.png

Demon
- 28th October 2023, 18:24
Ioannis (or anyone else who knows),

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

Demon
- 28th October 2023, 18:28
This is what you get when you ask for specs from a company on the other side of the world.
:D

https://i.imgur.com/pSblDZX.png

Ioannis
- 28th October 2023, 22:24
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

Demon
- 29th October 2023, 00:23
... 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. :D

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. :smile:

- 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

Demon
- 29th October 2023, 02:07
Ioannis, check this out.

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

https://i.imgur.com/fWdFSIj.png


The exact same circuit without the holes:

https://i.imgur.com/We6D2nC.png


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.

Ioannis
- 29th October 2023, 12:30
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

Demon
- 7th January 2024, 21:35
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.

9542


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

9543


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. :D

9541

Demon
- 7th January 2024, 22:17
Tweaked some stuff, but I could touch this up forever and I'd still find something.

9544

Demon
- 7th January 2024, 22:28
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.

Ioannis
- 8th January 2024, 08:18
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

Demon
- 8th January 2024, 21:58
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. :D

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.

Demon
- 10th January 2024, 00:10
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.

9546

Ioannis
- 10th January 2024, 09:49
Yes, it is very impressive the workflow!

Ioannis

Demon
- 11th January 2024, 03:58
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. :p 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/embed-with-elliot-debounce-your-noisy-buttons-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).

Ioannis
- 11th January 2024, 07:08
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

Demon
- 12th January 2024, 02:40
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.

Ioannis
- 12th January 2024, 08:02
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/embed-with-elliot-debounce-your-noisy-buttons-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.

9550

Ioannis

Demon
- 13th January 2024, 02:22
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. :D 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.

Demon
- 13th January 2024, 02:36
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).

9551

And best of all, it's free. :)

Ioannis
- 13th January 2024, 15:01
Why is the PWR_FLAG necessary to be added? Isn't +5V enough?

Ioannis

tumbleweed
- 13th January 2024, 15:57
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.

Ioannis
- 13th January 2024, 17:42
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

Demon
- 13th January 2024, 19:04
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-input-power-pin-not-driven-by-output-power-pins-3v3-and-gnd/39364/5

Demon
- 13th January 2024, 19:15
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). :D

9552



...
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/embed-with-elliot-debounce-your-noisy-buttons-part-i/

Ioannis
- 13th January 2024, 21:06
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

Demon
- 13th January 2024, 23:12
I really shouldn't work until the wee hours in the morning. That rotary switch circuit was totally not finished. :D

I've updated my pushbutton circuit.

9554


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

9555


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!

Demon
- 13th January 2024, 23:18
Here's my corrected rotary switch with corrected pull-ups.

9556

Ioannis
- 14th January 2024, 13:15
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

amgen
- 14th January 2024, 14:36
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 ?

Demon
- 14th January 2024, 17:59
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.

Demon
- 14th January 2024, 18:01
...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 :D ).

Ioannis
- 14th January 2024, 19:12
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

Ioannis
- 14th January 2024, 20:39
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

Demon
- 14th January 2024, 21:01
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. :D

Demon
- 14th January 2024, 21:05
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/AX0AAOSwwaFkFOD1/s-l1600.jpg

Ioannis
- 14th January 2024, 22:09
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

Demon
- 15th January 2024, 00:58
...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.

richard
- 15th January 2024, 01:17
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/saimon/i2cencoder-v21-connect-rotary-encoder-on-i2c-bus/

Demon
- 15th January 2024, 02:22
...
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)

9559


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

9558


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.

Demon
- 15th January 2024, 02:53
...
these things work great and are open sourced or you can buy some


https://www.tindie.com/products/saimon/i2cencoder-v21-connect-rotary-encoder-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/saimon/i2c-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.
:)

richard
- 15th January 2024, 03:32
you sketch is incorrect , with button pressed v test == 0.45 v

9560

Demon
- 15th January 2024, 03:40
you sketch is incorrect...


I used this guys design.

https://hackaday.com/wp-content/uploads/2015/11/proper_debouncing-sch.png


His explanation is here:

https://hackaday.com/2015/12/09/embed-with-elliot-debounce-your-noisy-buttons-part-i/


I've seen this design in other places. The 3rd resistor is to prevent the input pin from floating.

richard
- 15th January 2024, 03:55
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

Demon
- 15th January 2024, 04:01
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.com/questions/174016/in-a-74hc14-schmitt-trigger-ic-unused-inputs-outpus

Demon
- 15th January 2024, 04:03
..., 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.

Ioannis
- 15th January 2024, 08:16
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

richard
- 15th January 2024, 10:33
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

Ioannis
- 15th January 2024, 13:35
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

Demon
- 15th January 2024, 18:15
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

Demon
- 18th January 2024, 20:22
There's a god discussion on Reddit about JLCPCB.

https://www.reddit.com/r/PCB/comments/14sho3c/how_jlcpcb_manages_to_be_cheaper_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. :(

richard
- 19th January 2024, 03:27
This cropped up recently on arduino forum as a debounce in noisy [automotive] enviro as an effective debounce method

9563

Demon
- 19th January 2024, 06:40
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/ultimate-guide-to-switch-debounce-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.

Demon
- 19th January 2024, 06:55
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-Datasheets/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/embed-with-elliot-debounce-your-noisy-buttons-part-ii/#more-180185

Ioannis
- 19th January 2024, 09:29
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

Demon
- 21st February 2024, 06:32
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.

https://i.imgur.com/IILROh9.png

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. :D

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.

PCzar3
- 27th February 2024, 19:02
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 (https://frontpanels.com/frontpanelcreator/):)

Demon
- 28th February 2024, 05:35
Wow! Those are exactly what I am aiming to get.

Only one question, is that fee just for the designing on Panel Creator, and then a separate fee from Precision Graphics?

https://i.imgur.com/hM4vlhe.png


I've made contact with a manufacturer in China for something like these, but I haven't sent any models yet for pricing.

Demon
- 7th March 2024, 20:17
I just got 2 sample LCDs from a manufacturer. Holy crapenslaque! They're even nicer than my aging Acer displays (22in and 19in at top of pic).

https://i.imgur.com/N03Skbq.jpg


This is FHD 15.6in 1920x1080. It has HDMI and VGA inputs, and runs on ordinary 12V 2A power supply. If you get a USB-display adapter (maybe $25 on amazon), you don't even waste graphic card outputs.

It's freaking awesome, way better than I hoped, viewing angle is super. Way better than the crap I got on aliexpress:

https://i.imgur.com/QnKFdAN.jpg


Now I just have to make a case for it.

Ioannis
- 8th March 2024, 19:03
That is great! Nice choice.

What enclosure are thinking to make?

Ioannis

Demon
- 8th March 2024, 19:17
That part is still up in the air. My 3D printer only goes to 300mm x 300mm x 300mm, so that's not an option for a 15.6in display.

I might print it in 2 parts, then glue them together to make a prototype, then make a mold using Smooth-On silicon.

That might be my only option at this point.

Ioannis
- 9th March 2024, 21:40
At this size, maybe wood is an option for the prototype?

I saw Smooth-On silicon which is very exciting! But for an enclosure too much of work I guess.

Ioannis

Demon
- 10th March 2024, 19:34
I like wood, but it's a bit too bulky for what I had in mind. The prototype has to be thin, or else it's going to cost a lot of liquid plastic to pour each enclosure. I could use other medium, like plexiglass and superglue; that's my backup plan. I'd have relatively thin walls and a smooth surface, with a minimal strength. I'm just not keen on using superglue.

I'm looking at making the prototype on the 3D printer; most likely in 2 parts. That way I can have thin walls but keep a relatively high level of precision in dimensions. The other nice thing, is that modifying and restarting is just a matter of editing in FreeCad. With wood, you have to start again, same with all other "manual medium".

Demon
- 11th March 2024, 08:48
I drew up a basic frame, just to get an idea of what I'm facing; 15 hours, and there's no fasteners or anything.

https://i.imgur.com/3BX3sfj.png


The panel with all the holes was just a temporary support, since I have to print it an at angle on the printer. I'm still missing screws around the perimeter, and braces to hold it at an angle (I make my own, less waste, and they're signed specifically for the print). So I might be facing about 25 hours at regular speed on my printer for a complete front frame.

Then I have to print a honeycomb spacer for rigidity (maybe 10mm thick), and a backside with all the screws and required connector openings. I'm guesstimating at least 50 hours of printing for an enclosure prototype.

And this is why I'm considering a multi-part design. I could print it flat and wouldn't need to print all those supports. I'd have an annoying joint down the center, but I could live with that if I had to.

Ioannis
- 11th March 2024, 20:58
Whatever you choose for the prototype, it needs a lot of time.

At least with 3D you have freedom to do anything you like.

Keep on!

Ioannis

Demon
- 12th March 2024, 00:47
Like this:

https://i.imgur.com/CZDIrz0.png


I print 2 of these, rotate one around, and the pin at the bottom end will fit into the slot on the far right end:

https://i.imgur.com/mSCrs6s.png


Under 5 hours to print a single piece this way, so a total of 10 hours, no waste of supports, the face plate is essentially finished and a lot less time.

I just have to cover that joint with finishing putty, sand, prime, and I should be good to pour a silicone mold over it.


EDIT: Those 2 50-50 holes down the center are bugging me. I'll probably slide the bottom hole over to the left, and shorten the top beam. That way it'll be complete, no loose screw to jiggle about (in case I end up with a bad mold cavity).

Demon
- 12th March 2024, 02:14
Version 2:

- I made the alignment tab & slot longer, to help the frame glue perfectly straight.

- I only did drill marks for the cover screws. I'm using M3 self-tapping screws, I had problems making molds for small screws in the past. I just have to pass the frames under a dremel drill press to make the complete 2.5mm DIA holes.

https://i.imgur.com/xilJRRr.png


That center hole still bugs me. Gonna have to move it over a tad. :D

richard
- 12th March 2024, 03:41
are you printing in pla ?
if so what glue are you using , the only glue i find that works well is that nasty solvent based scigrip 16 [dimethylene chloride ?]
once you crack the seal it quickly dry's up in the tube no matter how diligent you are resealing it and its not cheap. i keep mine in the fridge.
super glue just unsticks and falls off after a few weeks

Demon
- 12th March 2024, 04:14
Can save a bit more time printing both halves at the same time.

https://i.imgur.com/QNQuMkk.png


I did a test print and quickly noticed something; the frame bends as it cools after being removed from the printer. I'm going to let it cool on its own on the printer next time.

(it's so light, the darn thing kept jiggling)

https://i.imgur.com/PIHR1yj.jpg

Demon
- 12th March 2024, 04:20
are you printing in pla ? ...

Yup.



...if so what glue are you using...

I was thinking of using crazy glue (cyanoacrylate - CA). That's the one that I'm seeing used online. Unless that's not crazy glue, but a newer product.

Which reminds me, I can test some crazy glue using that test print.

Demon
- 12th March 2024, 04:32
Confirmed on tube, ordinary cyano-thingy GH1200 from dollar store.

https://i.imgur.com/icQrDln.jpeg

Broke the frame in two, glued them together. I'm hurting my fingers trying to separate the pieces.

I'm gonna let it on the shelf and see how long it lasts.

richard
- 12th March 2024, 05:03
i find super glue won't last on "common garden variety" pla. there are quite a few pla variants around now, silky smooth , pla+ , pla super strong
that i have not tried gluing up. glue may not be the only issue, one of the silky variants i tried wont hold its shape over time in normal summer time temps/humidity either. its a bit of a mine field, abs is more durable/predictable but the fumes give me trouble.
had similar issues with resin printer, the nice fume free water wash up resins fall to pieces if exposed to sunlight for a couple of weeks
they come off the printer looking lovely, it was marketed as dental resin like .... not!
the first abs print i did to repair my weather station wind vane bracket has been out in the sun and rain for 10 or 11 years now and is still fully intact.
can't remember gluing abs but i think that was not easy either to get a good result , got some memories of acetone being involved

Demon
- 12th March 2024, 06:28
ABS is definitely superior. Check the plumbing section at the hardware store; look for the ABS glue close to the black pooptoobs (not to be mistaken with the PVC glue - those white tubes).

I'm using ordinary amazon PLA, and I was able to separate by hand the 2 pieces just now. Took an effort, but it did separate.

You do bring up an important detail about PLA; exposure to UV destroys it quickly. I'm using LED lights in the basement, but I want my original prototypes to live long without being OCD about keeping it in light-proof wrapping (I don't want to reprint later, then refinish the surface again - I know there's a lot of detailed work involved - I've done something similar before).

I guess that means development and testing with a glued-together PLA prototype (I'm gonna try Gorilla super glue - they tend to make quality products), then printing an ABS unit when I'm ready to make the mold.

Demon
- 12th March 2024, 06:40
Speaking of longevity, I made this silicone mold way back in mid-2000.

https://i.imgur.com/nsSOREs.jpg


Last time I checked it maybe 5 years ago, it looked "not bad", now it's got a slimy feel, and the main bulk has shrunk relative to the 3 small partitions. I'd say it was good quality for at least 10 years.

I don't know if Smooth-On has "watered down" their products by now, but I can guarantee they were awesome when I was playing with this stuff.

I also tested one of the liquid plastics that you can make threads. All I remember is that it was graded industrial strength, and was mixed by volume, 50-50 (I didn't have a digital scale back then and didn't want to be bothered with them).

Demon
- 12th March 2024, 16:33
So I did a full-frame test to see how cooling, warping and shrinkage would affect the end results. The frame shrank nearly 1mm at the widest part, and there's practically no warping (I left it cool on the 3D printer).

https://i.imgur.com/ua5bK48.jpg


I didn't do any detail work, like front bezels and covering that unused section on the top (it's actually upside-down, that's really the bottom).

Overall, I'm happy with the results. The screen fits just right.

https://i.imgur.com/y9W1eZ1.jpg


Now I have to see how I'm going to make the honeycomb innards, connector openings along the bottom edge, buttons on the lower front as well as supports for the main controller and button board.

Demon
- 13th March 2024, 06:23
I love FreeCad. I don't have to print the whole frame to do a test; I can just crop out the rest until I get the button section right.

https://i.imgur.com/TOnKPML.jpg


I still have to make a clear LED chimney in that 3rd hole from the left.

Buttons and cable fits snuggly in the frame.

https://i.imgur.com/zJwGoPp.jpg


I don't think Im even going to bother making caps for those pushbuttons. They are easy to operate.

https://i.imgur.com/NTDLrlh.jpg

Ioannis
- 13th March 2024, 19:39
It is really amazing what you can do with a relatively cheap machine these days! Endless possibilities.

I suppose the LED is between 4th and 5th button, right? Can you 3D print transparent plastic guide?

Ioannis

richard
- 13th March 2024, 20:02
clear UV set resin is great for making small transparent windows in housings, laser cut acrylic sheet can make light pipes [best used edge on], you lose a bit of brightness though

Ioannis
- 13th March 2024, 20:06
With resin you need a mold I guess.

But with laser cut acrylic sheet, the pipe may not be cylindrical, or is it?

Ioannis

richard
- 13th March 2024, 20:34
With resin you need a mold I guess.
I just tape the back side and fill the hole [if you use the thick stuff you can get a nice dome if your quick], shine led for a few seconds and ..
volar instant clear led bezel.

easiest if light pipe hole is rectangular and edge on for best effect. i have used those miniature diamond hole saws to get circle shape on the edge of acrylic sheet but its a bit fiddley. its handy out when the leds don't line up with the holes in the case, like when you 3d printed a mirrored image of your stl for 7 hours and don't have the heart to do it again

Ioannis
- 13th March 2024, 20:47
Thanks for the info.

Ioannis

Demon
- 13th March 2024, 21:29
...I suppose the LED is between 4th and 5th button, right? Can you 3D print transparent plastic guide?

Ioannis


Yup, and yup.

It's not even worth making molds to pour plastic light pipes. Since this is so small, I can 3D print a whole batch in no time.

Clear ABS:
https://www.amazon.ca/Gizmo-Dorks-Filament-Printers-Transparent/dp/B00GU2FZQQ/

Clear polycarbonate:
https://www.amazon.ca/Polymaker-Filament-1-75mm-Polycarbonate-Cardboard/dp/B09KKMLKRF/?th=1

Clear PETG:
https://www.amazon.ca/OVERTURE-Filament-Consumables-Dimensional-Transparent/dp/B07SB761QR/


It's not worth using PLA, it won't survive UV light. At the moment I'm leaning towards ABS because of cost, but polycarbonate is the clear winner according to google.

Demon
- 14th March 2024, 02:45
I've been playing with FreeCad; testing different ways to align the holes for the connections to the controller board. I finally got the splice tool working properly (I didn't want to watch videos :D ).

https://i.imgur.com/kv2fpHP.png


I reproduced the controller, with clearances under the board for protruding pins, areas for fasteners and added flares to the front of the 4 connectors. This is a lot easier, I can relocate the controller as I want, and generate new holes on the fly.

https://i.imgur.com/WYxJDNF.png

Demon
- 14th March 2024, 21:09
Turn out I can print the main parts in one piece. I'm pushing the limits of my Ender 3 S1 Plus, but in theory "it should work". The parts should have enough rigidity to withstand the stresses of being printed at an angle. I just need to add supports.

Case front is pretty much finished. I just have to add rounded edges and a bezel, but I'm only adding them last. FreeCad is a pain with those when you make slight alterations to the shape (probably cause I don't know all the minute intricacies of updating in FreeCad).

https://i.imgur.com/0l38tsL.png


Nearly finished the interior brace. I just have to add attachment points for a VESA-spec mount in the center.

https://i.imgur.com/2Pq8Un7.png


Just got the back panel to design, that's probably the simplest of all 3.

Ioannis
- 14th March 2024, 21:18
Never thought of that, printing to an angle so it can fit in the area!

I like this thread more and more!

Ioannis

Demon
- 14th March 2024, 22:27
You just like me for my pictures...

Demon
- 15th March 2024, 00:31
45deg was too shallow, 50deg was too tall, 47.5deg was just right under the upper limit, and fit within caution area on bed.

https://i.imgur.com/BW4ycI0.png


Print time is not realistic. This was done with a 10mm thick triangle, just to test for best print angle.

Demon
- 15th March 2024, 02:19
Sometimes when you make support panels, they might not have a lot of detail and it's not always apparent which way is which.

So I add little alignment markers to help me when I assemble it for a print (like on these supports).

https://i.imgur.com/UAFLxVR.png

Demon
- 15th March 2024, 06:38
The more I think about it, the more I'm leaning towards 3D printing to make the enclosures. There's a LOT of details in using liquid plastic, the one that scares the crap out of me is the vacuum chamber to degaz the liquid. I have the chamber and pumps, but I'm scared silly to have that thing fail. Liquid plastic makes a superior enclosure, but it's also labour intensive. With 3D printing, you start the job and go do something else; it literally doesn't take any of your time

The 300mm x 300mm x 300mm limitation of my Ender 3 S1 Plus was costing me a lot of time having to print at an angle. And then I fall on this puppy.

https://www.amazon.ca/gp/product/B0CD7S18PB/?th=1

The Anycubic Kobra 2 Max has a ridonculous 420mm x 420mm x 500mm print size that runs at 500mm/s (reviews say 300mm/s is better). Considering my printer runs at 50mm/s, that's a 6-fold increase in speed.

I'm definitely setting up an exhaust port in the basement. I could print my enclosure flat on its back with ABS, no supports, no wasted filament, and at an insane speed. I can still keep my Ender for supports jobs; like to print the smaller enclosures, brackets, light pipes, etc.

Ioannis
- 15th March 2024, 18:15
Well, OK with the self 3D printing for one or two pcs. But is it cost effective for small production?

What about using JLCPCB 3d capabilities? https://jlc3dp.com/?source=JLCPCB-top-productbar Will this be better choice regarding cost/time/quality?

Ioannis

Demon
- 15th March 2024, 22:12
I didn't even know JLCPCB offered 3D services. I have only one fear when dealing with China; it's having my idea stolen. I grew up in a time when China regularly cloned western products. I'm sure they still do today. Back then, they had to reverse engineer devices; now we're just sending them the actual prints willingly (whether it's PCBs, 3D files, etc).

I know that anyone could fabricate what I'm building; there's no rocket science involved. But still, I'm apprehensive about helping them clone my idea. I'd use multiple names for various components if I could, but that could create havoc with things like shipping, customs and such. :)

Out of curiosity, I got an instant quote for just the front panel for the display, $87.45. :D

I'm clearing more workspace for a Kobra 2 Max coming in tomorrow. I pay the printer in 6 prints, and I'm not even including shipping and brokerage fees on that, so it's probably more like 4 prints.


EDIT: One thing I'm thinking of doing, is having only the switches, encoder and pot circuits in china, and have the main USB circuit done with digikey.

Ioannis
- 16th March 2024, 20:54
Well, you do not have to tell them what you are doing. And after all, having a plastic thing printed there, what really means to them? They cannot figure what you are doing, right?

The $87.45 is for one piece?

Ioannis

Demon
- 16th March 2024, 22:25
...The $87.45 is for one piece?

Ioannis

Yup. I didn't even bother checking for quantities.

My enclosures consist of 3 parts; it's not like they will assemble it, the wrap and ship (they probably offer the service, but I'm not interested in taking them apart again once they get here.

I remember how JLCPCB likes taking humongous boxes, and that's what I expect from the 3D print service; each part wrapped separately. It's not like you can pile them up one inside the other either, I don't have a slope on the case. Shipping is gonna cost a fortune cause the final box is going to be huge.

Demon
- 18th March 2024, 06:43
Now this is a lot more reasonable than the Ender.

https://i.imgur.com/36fL7hU.png


5 hours 35 minutes for what was gonna take nearly 2 days. This is the normal profile in Cura (from Anycubic web site), with:


slow first layers
0.15mm layer height
0.4mm walls
10% infill
200mm/s print speed
lightning infill pattern (90 minutes faster than default grid)


Too bad it doesn't have 2 extruders. I could print my white text directly into the black casing.

Ioannis
- 18th March 2024, 19:17
10% infill means that the compact pieces are not really compact inside?

Sorry, but I am at zero, regarding 3D printers.

Ioannis

Demon
- 20th March 2024, 19:07
Yup. You can chose from many infill patterns at varying degrees of fill.

I start at the lightest just to test fitment, then move up until it's as strong as I want.

Ioannis
- 21st March 2024, 15:26
And I guess the higher infill the slowest process. Added to the more plastic usage, right?

Ioannis

Demon
- 22nd March 2024, 00:12
Exactly. It's really fast to print an empty shell, but don't sneeze on it. :D

The hard part is finding that right balance. I don't have stress testing equipment, so I have to use my better judgement.

I can't afford to destroy a LCD and controller card, but I can throw an empty enclosure onto the street and inspecting it for damages; looking for weak spots.

I'm the last house on a dead-end street, so I can easily stand out there and play soccer with my case. :D

Demon
- 22nd March 2024, 04:11
Well, you do not have to tell them what you are doing. ...

Yup. I googled "jlcpcb steals design" to see if there's a history of incidents, and fell on this thread right away:

https://www.eevblog.com/forum/manufacture/sharing-gerber-files-with-manufacturer-without-risk-of-copy/


Read « Reply #19 on: July 22, 2023, 07:30:50 pm » specifically. The best thing I've learned was "don't put your company or product name on the PCB".

And I JUST finished generating all my PCBs. :D

I'll go through them tomorrow and take out my company name.

Ioannis
- 23rd March 2024, 10:14
What I read from that thread is that you do not have to worry about stealing your idea from pcb perspective.

And I never cared about that. Maybe because I use most of the cases, MCU on board and no one knows which one or what firmware does it have.

As noted others on the thread you can just print the names and NOT the values of components on the board.

In any case who does care for my 10, 50 or even 100 pcs? And if someone manages to do what I do cheaper, then I will resale theirs and have more profit!

Ioannis

Demon
- 10th April 2024, 05:47
Just got my first order of 14 circuits, these look good:

https://i.imgur.com/yTc9TYq.jpg


Until you see the other end:

https://i.imgur.com/CIEVGI7.jpg


Oh well, live and learn. I had checked too many times, and was only seeing what I wanted to see. :D

Ioannis
- 10th April 2024, 18:52
Fortunately PCBs have two sides! Use the other now! :)

Ioannis

Demon
- 10th April 2024, 19:22
At first I went "Aaaaah crap".

Then I went "YAY! I can use the other side for my tests".

And then I found out the support pins are staggered and not reversible, "Aaaaah crap".

:D

Ioannis
- 10th April 2024, 19:49
Well, you are not alone! Happened to all!

Ioannis

Demon
- 25th April 2024, 23:21
So I have a need to override a pushbutton (from ON to OFF) and came up with this concept; a solenoid piggyback on a pushbutton switch with a 3D printed cap held by a strand of wire.

https://i.imgur.com/UbvJMbq.jpg


The system works, except the switch needs about 330 grams of force (according to specs, and my digital scale). The 5V solenoids are nowhere near strong enough, and this 12V variety comes up short. It struggles, but doesn't get the job done.

I sure could use ideas. It needs about 5mm travel to complete the stroke, and must not interfere with normal switch operations.

amgen
- 27th April 2024, 18:36
Hall effect switch with small magnet or if there is magnetic field around solenoid coil that the hall effect device can sense

Demon
- 28th April 2024, 03:51
One of the suppliers that had quoted me for that switch with the red shaft has a model with 100gf to operate. The model I am testing now uses 330gf.

It would be easier to use that switch cause I already have the circuit board tested, as well as a batch of white and yellow caps.

I just have to test to see if my solenoids can operate it properly (I have a stronger 12V batch coming in).

Demon
- 28th April 2024, 04:01
Hall effect switch with small magnet or if there is magnetic field around solenoid coil that the hall effect device can sense

I've never used those types of switches before. Do you have a link?

I need a latching pushbutton switch to simulate these controls. They have to remain down when pressed ON, and pop out when pressed again OFF.

https://i.imgur.com/rKpPoyO.png

Ioannis
- 28th April 2024, 11:24
Maybe you can use a small stepper motor with linear motion like the ones on the CD head mechanism?

Like this one https://www.aliexpress.com/item/1005005452598269.html?spm=a2g0o.productlist.main.1 .3492mhbEmhbEOI&algo_pvid=df7cce19-0b25-4f2a-9ae4-ef4d00fbfe0c&algo_exp_id=df7cce19-0b25-4f2a-9ae4-ef4d00fbfe0c-0&pdp_npi=4%40dis%21EUR%211.13%211.06%21%21%211.18%2 11.11%21%402103246617142998293611567ecb74%21120000 33139450338%21sea%21GR%21101297834%21&curPageLogUid=9giVJ31dO5SQ&utparam-url=scene%3Asearch%7Cquery_from%3A

Ioannis

amgen
- 28th April 2024, 21:30
not sure if I am understanding what you need, but if you need an indicator that the mechanism is in one position or another then a hall effect switch is just a simple 'proximity sensor'..... when the small magnet moves within range of the IC, that 'trips' the transistor to on until the magnet moves away..... one manufacturer, Allegro

[URL="https://www.allegromicro.com/en/Insights-and-Innovations/Technical-Documents/Hall-Effect-Sensor-IC-Publications/Hall-Effect-IC-Applications-Guide" [/URL]

Ioannis
- 28th April 2024, 21:38
The design is based on a classic switch (On/Off) but if I understand correctly, in special cases, the push button should be in a specific state and user is not allowed to change that.

Ioannis

Demon
- 29th April 2024, 23:55
not sure if I am understanding what you need, but if you need an indicator that the mechanism is in one position or another then a hall effect switch is just a simple 'proximity sensor'...

I need to override the switch position in software. MSFS will disable one of those leftmost yellow switches under a certain circumstance.

My first idea was to use momentary switches, and have an LED indicate ON or OFF. But I'd really like to override the switches physically from software.

And that's why I'm looking at that solenoid design; I can operate the button manually without disruption from the solenoid, and activating the solenoid for a short burst can turn ON or OFF the switch.

One of my main goals with this product is to simulate as much as possible the visual switches in MSFS - within budgetary reason.

Demon
- 30th April 2024, 00:04
Maybe you can use a small stepper motor with linear motion like the ones on the CD head mechanism? ...


That's always an option, but it's a slower mechanism.

And I still have the issue of having sufficient torque to activate the switch. The motor has a stroke length, but no mention of force.

The manufacturer of the pushbutton switch with the red shaft has come back with a price of $0.044 USD for a 100gf model; that is very affordable and essentially the same price I paid for the 330gf model.

Ioannis
- 1st May 2024, 19:32
My first idea was to use momentary switches, and have an LED indicate ON or OFF. But I'd really like to override the switches physically from software.

This is great but why cannot you do it? I think it is cheaper, no mechanics (that can fail), easier to build and only you have to disable it by software. Even if user pushes the button, nothing will happen.

Ioannis