0
\$\begingroup\$

I am 100% new to PICs and I know I have a lot to learn. My end goal is to have a DC motor controller that will operate a motor in one direction only and with the push of one button have the motor run at approx 80% (of the nominal speed) and with the push of another button have the motor run at 30% (of the nominal speed).

In addition when the speed changes I would like to acceleration and deceleration of the speed. I have ordered up a PICKIT 4 and one of their Curiosity boards to try on the 16F1704.

\$\endgroup\$
  • 2
    \$\begingroup\$ If you are talking about 80% and 30% speed, rather than power then you will need some kind of feedback so that the PIC knows how fast the motor is turning. \$\endgroup\$ – HandyHowie Nov 19 '18 at 8:19
2
\$\begingroup\$

First I suggest to learn a bit about the PIC. (Blinking LEDs, IRQs, etc.)

Then you have to systemizing. Specify smaller tasks.

  • Button handling. (Poll or interrupt)
  • Creating the reference (or set-point) of the controller. The reference can be a variable in your code, which time function have to describe the accelerating. I mean, when you want to accelerate, this variable should increment time by time. Use a timer interrupt.
  • Implement the PWM. You can test with an LED. The brightness depends on the PWM duty-cycle. (Note that the sense of seeing is logarithmic of the power.)
  • Design the power (switching) amplifier for the motor. The PIC can output some mA, while the motor (depends on the size) needs more than 1A. You need at least power FET(s).

Parts above can implement independently, arbitrary order. Verify all block separetly and then connect together. Then the system should work.

\$\endgroup\$
1
\$\begingroup\$

So long as the PIC has enough peripherals and memory, and enough potential clock speed to do what you need to do, you're OK.

That said, there are some PICs with interesting peripherals that are specialized for motor control-- quadrature encoder readers and fancier PWM that make optimizing H-bridges easier. The 16F1704 is not one of these.

A list of PIC controllers that are at least partially optimized for motor control is at https://www.microchip.com/design-centers/motor-control-and-drive/control-products/pic18f

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.