Need Code to Light up 12 LED Neopixel ring based on throttle position

Hi guys, long time lurker, but finally getting into some projects. I have a metro mini board, PWM low voltage speed controller, 5V motor, 12 LED Neopixel Ring all wired up. I am trying to display the throttle position of the motor on the Neopixel ring, in rainbow spectrum. Basically, split motor voltage into 12 steps from 1.8V - 5V((EDIT: lower Voltage on motor is about .62V bottom range, 4.63V full throttle, motor starts spinning at about 1V)) ( PWM integer output?) and each step of throttle position shows up as a Lit LED on the Neopixel ring (2Red, 2 Orange, 2 Yellow, 2,Green, 2 Blue, 2 Violet). Neopixel ring will act as a simple tachometer. I can fumble my way through code already written and adjust and do basic functions but I'm a total n00b. Happy to send some paypal or venmo to whoever can help with a working solution. Tight deadline on this project though for a tradeshow Tuesday. Thanks!

If possible, would also like the LEDs to sweep up lit from 1-12 then down to 0 like a tachometer when first powered up (maybe with a dynamic rainbow effect too : ) )

Metro Mini Pinout: Redirect Notice

Throttle: https://www.amazon.com/ALEDECO-Voltage-Motor-Speed-Controller/dp/B07P2BLG2L/ref=pd_lutyp_d_rtpb_sccl_1_2/144-4533811-4402017?pd_rd_w=qZkb2&content-id=amzn1.sym.e87e42ff-d9d6-4960-b250-a08faad41533&pf_rd_p=e87e42ff-d9d6-4960-b250-a08faad41533&pf_rd_r=7F5GCHPPTR8Y1CEABJQD&pd_rd_wg=dwRXg&pd_rd_r=3e2c016c-c7a2-4276-b760-d6b06b67d70b&pd_rd_i=B07P2BLG2L&psc=1

Hi,
do you really need to use this "throttle" or can you replace it with a simple potentiometer?

A simple potentiometer would probably be ideal, for space constraints and cost, can you post an example link? will need to source it via amazon prime to have it in time if this is a better route, but trying to use what I have based on my deadline. Thanks for your response! :smiley:

The output of this speedcontroller is most likely a PWM signal.
An Integrator can convert this PWM to a analog signal where the PWM-ratio is converted to a voltage.
This can be read with analogRead() and then you can convert this value to 1 to 12 for the LED's

Hey TechGraphix, thanks for the info, I had a feeling my speedcontrollor was sending PWM and making it harder on me. Is the integrator a code function, or hardware? This sounds like a great solution but I would still need someone to send some example code for me to get it running if possible

cheers

Willing to pay $50 for some example code I can adjust (pins, voltage range etc) and get it dialed in properly

Hi,
I'll try to help, but I don't know if you'll be able to send me some money, because here in Brazil it's a little complicated to receive money from abroad.
If I can help him and get the money, it will be used to buy toys that I distribute to needy children at Christmas. See photo from last year.

But I need to know more details about your project.
Do you only need the Neopixel Ring working, or do you also need the engine to work?

The neopixel ring and motor will be run in parallel, so they both work at the same time

A simple potentiometer will be here tomorrow via amazon, if that makes the coding easier to anyone interested

sorry, wasn't sure if this was spam or not, I appreciate the help. Very cool what you're doing to help out the kids!

I would have guessed you were younger. :wink:

Anyway, if you are running that PWM throttle with 5 volts, measure the voltage at the wiper of the potentiometer on the throttle. Between the wiper and GND.

If the throttle is based on a microprocessor design, that pot might just give you a direct low-ish to high-ish voltage maybe even 0 to 5 votls.

anallgRead() that and drive the neopixel ring form the digital value you get.

I don't have a handy charity, won't take money… this shoukd t be too hard, gotta read your first post carefully.

a7

What value of potentialometer?

Are you using the PWM throttle output to run the motor?

With a separate potentiometer you've complicated it a bit, as now the PWM must be generated by the program.

Not a deal breaker, but it would def mean more external circuitry - ironically parts you might find already in their near-final connections on that throttle board.

I'd start by using your meter and seeing if the votage from the throttle can be "listened in on" harmlessly.

A common GND and I think you might be almost ready for code.

a7

Hi Alto, thanks for the help! Here is the kit I ordered for potentiometer:

Im ok with using simple potentiometer or PWM one I already have, but thinking simple might be better, let me try listening in on the signal and see what I can find out.
Yes I am using PWM throttle output currently to run motor.

HI Alto, got some data for you, it looks like hooking the voltmeter to the power and ground coming from the potentiometer to the motor shows motor start up around 1V with a MAX of 4.62V

Potentiometer/motor are powered from the 5V pin on the Board
With ground pin for potentiometer to GND on Board
Neopixel shares GND pin on Board with GND pin on Potentiometer,
Motor Ground is Negative terminal on potentiometer, but not common with neopixel GND or Board GND,

Hi Alto,

(Motor +, Motor - on Pot)

  1. .62V at Bottom of Range
  2. 4.63V at full throttle
  3. Voltage on wiper: (Power - and Power+ on Pot) 4.86V at bottom of Range, 4.64V at Full throttle

(forum is limiting my replies for first day user, will have to edit replies to send you info)

OK, maybe… very good.

Try this if you will:

Put a non-motor but significant load on there, or actually wait a minute

you can report from the experiment you already are doing. And add informative further results.

Measure the voltage at the wiper. I don't care whether the motor the motor spins, just wanna know the voltage at both extremes of the travel of the pot.

Also, measure the voltage at the other two pins that make up the three a pot needs. Not the included switch on/off pins there look to be maybe.

We hope that one end is GND nearly, and constant throughout the range and the other end is nearly or all of 5 volts (measure that, make sure we taking feeding this 5 volts) and also constant.

I'm away from my lab but something trivial can get you going and may be satisfactory. Naturally I am anticipating a few little quirks that software of a slightly more detailed level coukd iron out.

Then you might have time leftover to get carried away with whizzy effects on the ring…

a7

Voltage at Wiper (power coming in from board to pot ) is
4.9V when wiper off
4.62V when max throttle

Im reading the voltage by voltmeter red + to power at pot, voltmeter Black to power - at pot

Wait, what happened to motor starts when the wiper voltage got to 1 volt?

Sry, looking at this through the little window just now.

a7

Sorry, I was measuring voltage into pot at those connections, if I measure voltage out to motor at red and black terminals on pot I notice the motor starts spinning around 1V

Input to pot is 4.9V when motor off, 4.62V when max throttle

Output from Pot is 0V when pot off, 4.63V when max throttle (motor starts spinning at 1V)

NP. Deep breath!

So please for my aging age, summarize the results

All tests perform with throttle pot between just clicked on if there is a switch, or at far end, and max, the other end. TBC move the control pot though the range it would but not turned off if it can do.

  1. voltage at one end of the pot, test all range
  2. voltage at other end, all ranges
  3. vo,take on the wiper

TIA

I'm trying to avoid smoothing the PWM from the throttle to read the voltage the motor is effectively getting.

And avoid needing to generate and amplify the PWM voltage you'd get from analogWrite().

a7

@alto777
so the task is quite easy...