Tuesday, August 24, 2021

The Black Knight Rises - First Light

The Black Knight playfield, lit up for the first time with the Chameleon IO Controller and ChameLEDs

Assembling a new Chameleon IO Controller board
Over the weekend I assembled another Chameleon IO Controller board, and it came out much better.

For this attempt, I upgraded my Reflow Toaster Oven with two additional 320w heating elements that I scavenged from a spare oven, bumping output from 1500 watts to 2140 watts, and this greatly improved the oven's ability to follow the solder paste reflow profile.  Of course this meant it was now too powerful for a normal household 120v 15A circuit, and I've only got a single 20A outlet in the entire house.  Luckily it's in the perfect spot in the garage right next to the garage door, which I can open for fresh air during reflowing.

I also installed my 3D printed linear clamps on the stencil printer, which greatly improved solder paste alignment, preventing movement during swiping.  

I switched to some fresh solder paste, ChipQuik's Smooth Flow, and wow did it flow smoothly!  The deposited paste looked much thicker compared to my previous attempt which had sparse amounts of paste in a few spots.  I was actually worried it might be too thick, even though I only made a single swipe.  


Semi-pro stenciling tip: do NOT make multiple swipes, as with each swipe you force extra solder paste through the stencil and it builds up and leaks under the stencil, causing shorts during reflow. I made this mistake often in the beginning. Automated stenciling machines make a single quick swipe only, and you should replicate this method if doing it manually.  You have to trust the process, it works.


One additional tweak I made was simply working faster.  The last board I assembled took over 4 hours from stenciling paste to reflowing the board, and the solder paste I'm using only has a 4-hour working window.  This time I went from stenciling paste to reflowing in under 1 hour!  

Those 4 changes addressed the biggest issues I noted from my previous attempt, and they definitely helped a ton.

Unfortunately, a new issue cropped up.  Read on to learn more and see the First Light Video!

For some reason, my Charmhigh CHM-T36VA pick and place machine seems to have a mind of its own - or at least some bugs around PCB calibration.  During parts placement, many of the IC's were placed about 1mm low, even though I had configured them perfectly for the previous board.  I had to nudge them back into place manually, which squishes the solder paste around, and for small pitch components this often causes shorts.  

I was sure that this was going to ruin the entire board, but to my surprise I got a 95% perfect board, with 54 of 56 gamepad buttons working, and 105 of 112 outputs working.  

All of the defects were due to the incorrect placement by the Charmhigh, so I've since been working on tweaking the jobs to improve accuracy, and hopefully the next board will be 100%.  The amount of babysitting this machine requires is frustrating - I don't think it would ever be possible to simply let it run unattended, you just can't trust it, making it harder to realize my goal of making hundreds of boards.

Luckily, The Black Knight only requires 32 switches (36 if I swap in the modern style 8-ball Pinball Life ball trough assembly), 17 solenoids (18 if I later install an auto ball launcher), and 76 lamps.  Though it required moving a few wires to different headers to avoid the handful of bad outputs, my latest Chameleon IO Controller is finally good enough to control the entire The Black Knight playfield.

That Black Knight playfield has been hanging around in a rotisserie in my office for the past 4 years, with nothing better to do than collect dust, so it was pretty exciting to clean it up and swap in the working IO controller.

The working Chameleon IO Controller, top center, finally ready for a light show


First Light
Here's a video of it in action, powering up the lights for the very first time.

For this test I just used a cheap 5v USB charger that was handy, and it's way too weak for this many high powered LED's.  I'm shocked that it did this well, especially those CoinTaker bayonet LED's that are designed for 50mA at 6.3v.  My own ChameLED's are designed for 5v, so they look much brighter here even though they also draw up 50mA each.

All lit up on 5v juice, the 21 CoinTaker LED's should draw about 840mA, while the remaining 55 ChameLED's draw around 2.75A, for a total of 3.6A!  I'm surprised my little USB charger hasn't burst into flames.  With everything lit up, the voltage sags too much, dropping to 3.75v, so the total current draw is below the 2 amps this USB charger can supply.

My 5V, 5A, 25W industrial power supply with adjustable voltage - it's tiny!

This is only a problem on my test stand.  For my final build I'll use a stronger power supply for the lighting.  A 5v 5A power supply should be perfect.  I have an industrial style power supply that has a voltage adjusting potentiometer, which should allow me to tweak the voltage closer to 5.5v.  That way I'm only undervolting the Cointakers by 13%, and overvolting my ChameLED's by 10%.  Since the LED's I used are rated for 100mA, they can easily handle a bit of extra power beyond the 50mA to which I designed the ChameLED's.


Dynamic Link Library
This video represents another huge achievement, as all of the data being sent to the Chameleon IO Controller is being processed through a Dynamic Link Library.  The DLL takes the commands from the main application, and processes the data into the format needed by the Chameleon IO Controller to initialize it and set each output PWM level.

This means I can initialize the controller with these 2 lines of code:
CIOC_Init(1);
CIOC_Init(2);

And send all 112 PWM values, in a 112 byte array named 'PWMValues', with this 1 line of code:

CIOC_SetPWM(PWMValues);

How simple is that?!  

I'll program a few other commands into the DLL to configure the controller, like setting up the 8 special hardware PWM outputs for the desired behavior, switching between software PWM and software PFM, and also handling hot-plug events.  

This DLL makes the Chameleon IO Controller a plug and play solution for any programmer, not just my own pinball code.  Perhaps even Mission Pinball Framework. 


Performance Analysis
At the very end of the video above, there is a quick sweep of all lamps, one-by-one, that looks like paparazzi flash bulbs firing.  This is a function in my test software that briefly turns on and back off each output, starting from output number 112 and going down to output number 1.  This demonstrates the speed at which my software is able to update the Chameleon IO Controller.  I analyzed the video, and it took about 28 frames (in a 30 FPS video) to sweep through all 112 outputs, which is a refresh rate around 120Hz.  

That means each command set to the Chameleon IO Controller took about 8.3ms.  This is slightly higher than I was expecting after my recent latency testing and performance improvements.  

I still have some testing to do to figure things out, but I expect the slightly lower performance is due to updating 112 outputs, instead of the 56 outputs I was updating in my previous test.  I only tested 56 last time due to a defective board, but since this board is 95% operational I'm now testing all 112.  I also have to consider that my DLL might be having a performance impact, so I might have to do some back to back tests both with and without the DLL solution to see if there's a difference.

The light-sweep demo is also just some test code, not my actual pinball software.   It is just a quick and dirty tool to test the boards, and it lacks multi-thread optimization.  In my Chameleon Pinball Engine software, I found that adding extra threads greatly improved latency.


Switch Testing
The Chameleon IO Controller is also responsible for receiving switch inputs, so I quickly tested all the switches to make sure they were working correctly.  I put my software in switch testing mode, which lights up an LED each time I trigger a switch.

I was happy to find that all but two switches were working.  One switch, a 40 year old leaf switch, just needed the contacts cleaned.  And the other switch is a microswitch in the ball trough that marginally works but probably needs replacing.  I got it working for now by bending the activation arm to apply more pressure.  I plan to swap in the Pinball Life 8-ball trough in the future, which will replace that switch.  I only used this old-style ball trough so that I could develop code to work with them.

Now all switches are working!  That was easy.


Next Steps
With the initial light and switch testing complete, the next objective is to test the solenoids.  For this, I'll have to use my pinball software, which precisely controls the firing time of the solenoids to prevent burning them up.  It will probably take me a week or two to update my pinball code to use the new Chameleon IO Controller (added complexity because I'm keeping backwards compatibility with the LED-Wiz).

I also need to connect up my 38v solenoid power supply, which shouldn't be too hard.  The hardest part will be making a connector bracket to route all USB, 5V and 38V power to the top edge of the playfield.

No comments:

Post a Comment