There isn’t really any story behind this.
I have a joystick module, and it would be pretty simple to hook it up to a motor and use it for a remote control car.
I decided on a few parameters:
- No microcontroller. Where’s the challenge in that?
- Joystick wired directly to the car. Wireless can be a stretch goal, this is supposed to be a really quick project.
- Front/back on the stick will drive 12v DC motors with variable duty cycle PWM for speed control while keeping torque high
This is a reasonably complicated analog circuit, and I really do prefer to simulate my numbers when I do that, just to make sure that I have a valid starting point for real-world tweaking.
I’m not really that keen on diving into SPICE (especially LTspice, which would be my only option, at the moment), but a cursory Internetting around came up with CircuitLab. Now, I’m not normally one to plug some commercial service without very good reason, but this service is seriously pretty great. It’s an online, cloud-based schematic editor and simulator.
I’ve been playing off and on with online services for five or six years, but really nothing has been any good. But this one is really intuitive, free for non-commercial use, and they don’t even nag me about buying anything, even after detecting that I have an adblocker.
But anyway. I may or may not build this, it was mostly an op-amp and 555-hysteresis exercise.
Here’s the first stage, with a potentiometer(R5) controlling the op-amp output voltage. Varying the voltage adjusts the control voltage that the capacitor is allowed to charge to, causing the output duty cycle to change.
Here’s a steady-state simulation of R5 low, PWM output (and therefore DC motor speed) low:
R5 high, PWM output high:
Perfect.
That’s only half the battle, though. I need to get two inverted PWM signals coming off a single potentiometer, centred around the middle.
Part of the challenge of that is that you can’t just duplicated the above circuit. When the pot is involved with both high side(for controlling forward) and low side(for backwards), the circuits are somewhat in parallel.
Some small resistors to ground where needed to mitigate that. Eventually, I got a gorgeous graph that looks like this:
The important takeaway here is that the output voltage at the joystick-centred position is effectively nil for both sides. Each one respectively ramps up when the potentiometer is shifted to their side.
The 555 output stages aren’t in this simulation because they don’t change from the first circuit.
Here’s the second circuit:
The low-side 555 circuit isn’t shown either because again, doesn’t change.
A couple more notes:
- I’d actually be driving this circuit with 12v, but capacitor charging rates are all relative, so the timing wouldn’t change.
- Those two resistors to Vcc and GND, R6 and R9 are to adjust the joystick trim.
- CircuitLab actually has excellent export options, too. I didn’t use them because I like the gridlines.
Again, this project is mostly just a fun simulation exercise. If I’m ever really hard-up for something to build, I’ve got everything written down here so I can do it. That may never happen, though.