Paintball Trigger Force and Displacement Data Logger

I am working on a project for a company designing paintball triggers. We currently use old, expensive and proprietary PLC architecture for a data logging test rig. I believe that open source hardware has come far enough to the point where I can replicate the entire functionality of this previous rig possibly to an even better degree, at a fraction of the cost. My prior experience with this stuff is very much at the simple hobby level with Arduino and I have a very limited understanding of signal processing which I have been attempting to learn. After exploring and researching how I can achieve this, I landed on the Teensy being the most capable microcontroller for this task.

The previous datalogger is capped at a sampling rate of 10khz and a resolution of 16 bit. How the rig works currently is we have strain gauge load cell attached to a linear actuator stepper motor which pushes against the trigger. The displacement of the trigger is measured by a linear potentiometer which is also actuated by the stepper. With these 2 inputs we can generate a force vs displacement curve, which helps understand trigger creep.

I am aiming to remake the rig and add more powerful sensing capability in the future, and hence landed on using an external ADS from TI, which samples at 32khz and a 24 bit resolution. I can also sample simultaneously on 8 different channels which allows for more expandability in the future. To prototype with this chip, I will be using this breakout board and I understand to interface with my external ADC with the Teensy I will need this external 8.192 MHz clock.


At a high level how I understand my system to operate will be for the Teensy to log the raw sensor data input store it to RAM, then write to the SD card which can be used later for post-processing, clear the RAM, and repeat. I am also considering writing data to RAM, then transmitting the data through wifi to firebase where I can process and filter the raw data with DSP using python, then send the data back to be displayed on an LCD. I envisioned the processing part to be done off-board due to the speed requirements of my data logging. However I know the Teensy is capable of DSP and has an audio library built for it, which would be nice to use if possible.

From my basic understanding, I think I should have enough RAM, assuming all my sensors had a frequency response equal to my sampling rate, and I collect my trigger data over 3 seconds, 32000kHz x 3s x 24 bits = 2304000 bits which is only 0.3 megabytes.

At the current stage, I am choosing what type of peripherals and sensors I should use. Given the nature of the project, extreme precision to the 1-10 micron scale is desired. Cost is not really an issue for my peripherals considering I have the potential to save 15k+ by ditching the old datalogger and PLC.

For actuation, I was looking to ditch the linear pot and somehow use an encoded stepper to measure displacement, but I think backlash would be an issue.
For load cells, I found out that strain gauge based load cells are actually incapable of the really high sampling rate that I have the potential to utilize. It's not a huge problem as the current system using a strain gauge load cell which has a frequency response of around 1 kHz. However more datapoints wouldn't hurt, so I have been exploring piezoelectric load cells but I know they have some caveats related to creep but I don't fully understand this so I am curious to if this would be viable.

For the load cell, I know that my ADC has a built in instrumentation amp at each pin which I can use to amplify the load cell signal. I this would be sufficient to pre

One of the products I explored for actuation was this piezoelectric micro linear actuator, which is really cool and has nanometre levels of precision. Only problem here is the force output limitations for one actuator cap at 10N. I require a minimum of 50N for my triggers.

I would really appreciate any advice related to my approach, any major hurdles or key things I need to consider, other things to buy, how to get started with prototyping etc. Or even if I'm totally in over my head and this isn't achievable. Thanks!
 
At a high level how I understand my system to operate will be for the Teensy to log the raw sensor data input store it to RAM, then write to the SD card which can be used later for post-processing, clear the RAM, and repeat. I am also considering writing data to RAM, then transmitting the data through wifi to firebase where I can process and filter the raw data with DSP using python, then send the data back to be displayed on an LCD. I envisioned the processing part to be done off-board due to the speed requirements of my data logging. However I know the Teensy is capable of DSP and has an audio library built for it, which would be nice to use if possible.

From my basic understanding, I think I should have enough RAM, assuming all my sensors had a frequency response equal to my sampling rate, and I collect my trigger data over 3 seconds, 32000kHz x 3s x 24 bits = 2304000 bits which is only 0.3 megabytes.
Are you sampling just one channel at 32 kHz (0.1 MB/sec), or more than one? If it's just one, then you have enough RAM to record for 3 seconds and then either write to SD or transmit via Ethernet. If it's 8 channels, for a total of ~0.8 MB/sec, Teensy 4.1 can easily keep up with that data rate to SD. You would need a RAM buffer, but it wouldn't have to be very large, probably less than 100 KB, leaving you plenty of RAM for your code and data.
 
For actuation, I was looking to ditch the linear pot and somehow use an encoded stepper to measure displacement, but I think backlash would be an issue.
Aren't you measuring when going in one direction only?
If so backlash isn't a problem.
I wouldn't measure in both directions as you will get backlash (not in the normal sense of screw nut backlash) due to the forces unloading (stresses being released).
 
Are you sampling just one channel at 32 kHz (0.1 MB/sec), or more than one? If it's just one, then you have enough RAM to record for 3 seconds and then either write to SD or transmit via Ethernet. If it's 8 channels, for a total of ~0.8 MB/sec, Teensy 4.1 can easily keep up with that data rate to SD. You would need a RAM buffer, but it wouldn't have to be very large, probably less than 100 KB, leaving you plenty of RAM for your code and data.
To start I will be sampling just one channel for the load cell but most strain gauge load cells I've found don't have a natural frequency response greater than 2 KHz so I think that means I won't actually be sampling the load cell at 32kHz? Unless those two are unrelated. Later I need to incorporate other sensors which might have a frequency response that is much higher. From my research I think the maximum natural frequency response for my sensors should be less than 16kHz, something to do with Nyquist frequency to prevent aliasing. I could be wrong on this too.
 
Aren't you measuring when going in one direction only?
If so backlash isn't a problem.
I wouldn't measure in both directions as you will get backlash (not in the normal sense of screw nut backlash) due to the forces unloading (stresses being released).
Only in one direction but when I finish testing a trigger, I need the actuator to reverse and return to its original position so I can test another trigger. If I choose to go with the stepper motor with encoder route, I think I would test it with the linear pot as well and see if the data matches so for future models I can eliminate the redundancy of the pot.
 
At the moment I would like to start by first getting data from a load cell through my external ADC which I can display on the serial monitor. For that I want to setup the external ADC connections with the external clock. I would like some help figuring out the pin outs and connections for this.

To start I know I need to connect the AGND pin to my common ground from the Teensy. I have a four wire load cell, I know 2 of the wires are Analog positive and negative, I guess those can go to the positive and negative analog input AIN0N and AIN0P? The other 2 positive and negative excitation pins I think they go to my positive and negative voltage from my power supply, but I'm not too sure what that means. For the external clock, I know it has 4 pads: Tri-state, Gnd, Output, and Vdd. I don't know what tri state or output means. Any help on this would be appreciated!

1715787139407.png

1715787169577.png
 
After some further research from the datasheets I think I have some idea of the connections, but I need some verification.
  • Power Supply and Ground:
    • DVDD from ADC goes to Teensy 3.3V.
    • AGND from ADC goes to Teensy GND.
  • SPI Communication:
    • ADC SCLK (serial clock) to the Teensy SCK1 (SPI clock) pin 27.
    • ADC Din (serial data input) to the Teensy MOSI (master out, slave in) pin 11.
    • ADC DOUT(serial data output) to the Arduino’s MISO (master in, slave out) pin 12.
    • ADC CS (chip select) to any digital pin.
  • External Clock:
    • Tri-state pin to any digital pin of the Teensy for controlling the clock state.
    • Output pin to the XTAL1/CLKIN pin of the ADC.
    • VDD and GND to the Teensy 3.3V and GND lines.
Since the ADC using SPI communication, in the future since I want to connect an LCD display for displaying the data, is this not possible due to not enough SPI pins or would the LCD just be an additional slave device and use the same pins?
 
Since the ADC using SPI communication, in the future since I want to connect an LCD display for displaying the data, is this not possible due to not enough SPI pins or would the LCD just be an additional slave device and use the same pins?
You would just give the LCD its own CS pin and connect it to the existing clock+MOSI (and MISO if it needs it).
 
Earlier I stated that the two signal wires of the load cell can go to positive and negative analog input pins AIN0N and AIN0P on the ADC. After some more research I found that Arduinos and Teensys can only handle positive voltages on their inputs. Is this irrelevant for me because I am using an external ADC? What about if I had a sensor that didn't have a positive and negative signal wire like the load cell? Would the single signal wire go to just the positive analog input of the ADC?

Also what about REFIN for the ADC...the external voltage reference input? It sounds important but I don't fully understand what it means for my system. This is a snippet of what I read about it:
Therefore, the accuracy of the reference voltage level is of great concern when precision measurements are needed.
Some ADCs have an internal reference, or they can be configured to use either an internal or external reference. There are some advantages to using an external reference for an ADC, most principally centering around accuracy. If you opt for an external reference that can guarantee greater stability against power and temperature changes, the two standard approaches are to use a precision voltage reference or a ratiometric reference.
Am I okay to use the in-built ADC reference, is the voltage reference of the Teensy overridden by using the external ADC? Or do I need a completely different chip for the reference?
 
Another question I have about the load cell is regarding the excitation voltage. The load cell I will be initially using for testing is from Interface. It has a max excitation voltage of 15V but 10V is the most optimal as it guarantees the user the closest match to the original calibration performed at Interface. What I don't understand and am having trouble finding information about anywhere is the current requirements for the power source used to provide the excitation voltage to the load cell. What I assume is that like many sensors, the voltage source can be run directly off the microcontroller and the current outputs from the analog pins are sufficient. I also assume that the load cells strain gauges are very sensitive and have low current requirements. If this is all true, could I just run a boost converter off the teensy 3.3V line to provide the excitation voltage of 10V and avoid using an external power source?
 
Another input that I want to test with my ADC and teensy is this linear potentiometer. For this product I am also only provided with the max applied voltage. Is this the same as the max excitation voltage, and is there a way to know if this potentiometer would run at a lower voltage, say 15V without testing it? I have a model of the sensor which has a 2k ohm resistance. So 28V/2000 = 0.014A = 14mA. If I ran this sensor at its max voltage, would it be accurate to say the sensor consumes 14 mA of current?

1715880684553.png
 
It is a resistive potentiometer. You can power it on any voltage. But the signal sent to Teensy should be converted to the 0-3.3V analog range

Angelo
 
Last edited:
Back
Top