Plasma Table Arduino THC: Software Overview
swolebro
Upshot: A thorough look at the code for my DIY Arduino based torch height controller, for my LinuxCNC plasma table build.
Topic index: 00:00 - Intro, where to find the code, summary 05:13 - sevseg LCD 06:40 - scaling and clipping on the input signal 09:38 - thresholding 12:20 - pin selection for Arduino Nano 13:10 - circular buffer for tracking averages, misc variables 15:35 - setup function summary 17:06 - pin modes, ADC setting 17:55 - implementation of the LCD and setpoint selection 26:02 - setpoint scaling, reset values before loop 28:14 - the loop function 29:30 - bitshift for averaging 32:22 - picking the sample size for the average 35:05 - comparisons to send signals 38:53 - bitwise and's 41:20 - Stack Overflow! 42:27 - the buffer size 43:04 - LCD refreshing, slow moving average 46:33 - wrap-up
GitHub links: This exact version: https://github.com/swolebro/swolebro-youtube/tree/cbd3e804a06677a460798404d5a60d336f19baf5/arduino-thc Latest version: https://github.com/swolebro/swolebro-youtube/
This my playlist, just for Arduino stuff like this: https://www.youtube.com/playlist?list=PL9xPdBFt5g3SHT1WvcGovHCzQ3Ag_kZeZ
Here's the full plasma build series: https://www.youtube.com/playlist?list=PL9xPdBFt5g3Q6TkuhhfQmQNm6TdvNkPuX
Just the LinuxCNC stuff, including the HAL tutorials I mentioned: https://www.youtube.com/playlist?list=PL9xPdBFt5g3Qnn3ZY2wYh7L2yzZ377UwI
So, some thoughts on smoothing the readings better while still keeping a short response time... Basically, you need to be able to read faster. With the speed of the ADC right now, it takes about 2.5ms to read 16 samples (fully going through the contents of the circular buffer). If you added a cheap, external, 100kSample/sec ADC (perhaps even with 16 bit resolution), then you'd be able to read 250 samples in that same time frame. Less noise, but still fast.
Of course, with a fast enough external ADC, you eventually start sampling faster than the frequency of the noise on the plasma, and you have effectively turned your Arduino into a janky oscilloscope.
It's worth mentioning that since the signal is very noisy, and we are clipping at 4.450*50=222.5VDC with this setup, we might end up clipping some of the higher-end readings in that noise, which in turn reduces our 16 sample average. I can't really be sure, since I don't have an oscilloscope to let me view just how noisy this signal is. In either case, I'm not super worried about it.
Your donations help me make more cool shit: http://paypal.me/swolebroshopworks ... https://www.youtube.com/watch?v=nmXoZt423WI
197814882 Bytes