Modifying a PWM signal - Hacking a RC car!

hippy

Technical Support
Staff member
One way would be to do a PULSIN on each channel, determine what the PWMOUT duty/frequency should be and output those.

The PWMOUT will run in the background while doing PULSIN but the problem is you have four channels to read, and you don't know which have PWM and which are static high or low so you will have to rely on 'no pulse detected' zero return value timeouts. That might make things rather unresponsive.

You could convert the signals via R-C circuits to ADC which might speed things up.

You could also possibly bit-bang time what's happening on the inputs. That would perhaps depend on whether changes are synchronised by the controller currently driving the motor driver, what frequencies they run at, what range of PWM they use.

You could use a PICAXE per motor which will probably be easier than trying to handle two motors on one PICAXE.

It might be easier just to replace the controller chip with a PICAXE.
 

tarantulataramasalata

Senior Member
Hi - thanks for the reply. I think replacing the motor driver with picaxe is the most likely bet - however, which pins are inputs?

Do these pic links work? https://prnt.sc/kr0t60 https://prnt.sc/kr0tb4

The more I look at it the more it doesn't seem to resemble the datasheet I linked to. TBF there's no reference to the MX1919L number I googled, only that it does a similar job.

Thoughts appreciated...
 

hippy

Technical Support
Staff member
It can be difficult modifying existing product when they use components which aren't easily identifiable and the spec is unknown, particularly so when they use 'ceramic blob' COB ( chip on-board ) devices.

Sometimes the best course is to strip everything back to what one can control and understand. In this case that may be the motors, replace everything else; controller, motor drivers.
 

slimplynth

Senior Member
It can be difficult modifying existing product when they use components which aren't easily identifiable and the spec is unknown, particularly so when they use 'ceramic blob' COB ( chip on-board ) devices.

Sometimes the best course is to strip everything back to what one can control and understand. In this case that may be the motors, replace everything else; controller, motor drivers.
I've done as hippy says.. It's my winter programming project; old RC car that belonged to a nephew who lost the controller.. destined for the skip... it's one of those that has no up or down side... huge wheels.. i just took the dremel to it and connected directly to the motors as it seemed easier.. using these to control because it's just too fast to control on an fpv...

https://www.ebay.co.uk/itm/MUZOCT-L298N-Motor-Drive-Controller-Board-Module-Dual-H-Bridge-DC-Stepper-For-Ar-/332405981786
 

JimPerry

Senior Member
Yes - and the supply will be short circuited :confused: use a 10k resistor in series to prevent a dead short
 

Dartmoor

Member
As Hippy says, using an RC circuit & reading ADC should be straightforward. Certainly easier than reading pulse in?

An H bridge on the Picaxe outputs avoids the suppression diode polarity issue?
(In fact, depending what the voltages are, simply adding a cheap H bridge may drop the voltage enough anyway?)

Possibly even easier (& non Picaxe solution) would be to use a dc/dc (buck) step-down converter such as this:
https://www.gearbest.com/other-accessories/pp_227261.html?wid=1433363
Note that this would have to be fitted between battery & controller (not between controller & motor!).
 

inglewoodpete

Senior Member
Thanks again for the replies.

If a motor with a emf suppression diode is being reversed, won't the diode then be the wrong way round?
Back-EMF suppression for a reversible DC motor is often performed with a bridge rectifier (AC legs to the motor) and an electrolytic capacitor with resistor in parallel (rectifier DC legs). The motor's back emf charges the capacitor and the resistor discharges it.
 

techElder

Well-known member
Some things just don't seem to make any sense to me. "Back-EMF suppression" on a motor meant to go both ways.

Perhaps this is a solution without a problem?

Why not wait to see if there is a problem? :D
 

tarantulataramasalata

Senior Member
News update:
I have had some success by using a couple of solid state relays, at the back end of the car's motor driver, chopping the current further. Some period/duty combos seem to slow the motor speed! :D But trying to change that slow speed doesn't seem to do much.

- What is the resonator speed of the 08M2?
- I have tried the pwmdiv command but it doesn't seem to change the speed.
- Without knowing the output of the motor controller, any thoughts on a period/duty value that might slow the thing to a crawl?

Cheers :giggle:
 

tarantulataramasalata

Senior Member
OK - can anyone help with this? I have used the formula in the manual to calculate the length of time for the period and duty cycle using the default 4MHz speed: (I've posted it as an image because I can't seem to paste a table).

Questions: Have I got the formula correct? Are columns F and H in seconds?

Thanks

1538125670970.png
 

hippy

Technical Support
Staff member
Questions: Have I got the formula correct? Are columns F and H in seconds?
The formula in F looks roughly correct. It should be -

t = (periodValue+1) * 4 / 4000000

And the result is in seconds. For period of 32 the 't' is approximately 32us.

I am not sure what H is meant to be showing.
 

hippy

Technical Support
Staff member
For any given period value, a duty value which is twice the period value will give a 50% duty.

So, for a period value of 32, the period time is roughly 32us, and if the duty value were 64 then the PWM output would roughly be 16us high and 16us low.

What your G column is showing is the period value times four, which is the duty value to give 100% duty, which means that the PWM output will be on for 100% of the time of the period time, so column F and H will be the same, as they are.
 
Top