Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Replacing a POT with a PIC

Status
Not open for further replies.

The_UnforgiveN

New Member
Maybe it sounds weird, I don't know :)

I have a question. I have a brushless motor driver. It's speed is controller via a potentiometer. Motor controller has 3x1 socket. I connect 3 pins of the pot to this socket and I can control the speed of the motor with this pot.

But, I need to digitalize this process. I want to use a serial interface. I will connect a PC to a PIC micro via RS232 and control the speed of the motor. How would the circuit be to achive this, not in the serial communication but in voltage divider part?

There exist 5V across the pot. When it's divided as 1.3V and 3.7V the motor starts rotating. When it comes to 4.2V and 0.8V, it reaches maximum.

Should I use two PWM outputs to generate this voltage couples? Or any other alternative way? I do not have any datasheet or other information about the motor controller. It's a chinese product.

Thanks in advance.
 

MikeMl

Well-Known Member
Most Helpful Member
One way is to use a 5V DAC. There are DACs available with both serial and parallel interfaces. The DAC could be controlled directly from the computer's parallel port; no PIC needed.

There are ways to use a PIC as a DAC. Poke around Microchip's application notes for some pre-worked examples of how to generate a slowly changing output voltage by PWMing a PIC port pin, and then using an analog filter to smooth the output.
 
Last edited:

kpatz

New Member
To clarify what MikeMl said, you'd connect your 0-5V DAC output (or filtered PWM PIC output) to the middle connection of the pot socket (the one where the voltage varies when you adjust the pot).

There's also "digital potentiometer" ICs which you can use as well. But since the pot is just being used as a voltage divider, feeding a control voltage into the pin should work.
 

The_UnforgiveN

New Member
Thank you both for your replies.

I will use probably 16F877 or 18F452 kind PIC micro. As I understand, I will generate a PWM output and connect this pin to the middle input of the potentiometer input of the motor driver. Am I right?

Will this work?

In the current setup, the three pins of the pot is connected to the three input of the driver. So the pot is a passive element. There is 5V across the potentiometer. But when I use PIC micro to generate a voltage to the middle pin, what will be applied to the other inputs? Won't be the PIC micro an active element. I'm confused at this point.

Thanks
 

MikeMl

Well-Known Member
Most Helpful Member
Connect the motor controller pin that used to connect to the bottom end of the pot to the PIC's ground pin. Connect the motor controller input that used to connect to the pot wiper to the DAC output. Leave the motor controller input that used to go to the top end of the pot open. Constrain the DAC output to duplicate the voltage levels at the pot wiper. Make sure you filter the PWM so that there is little ripple at the wiper input.
 

MrAl

Well-Known Member
Most Helpful Member
Hi there,


Another possibility depending on accuracy and other things, is you may be able to
use a digital pot. A digital pot is a chip that accepts digital signals and provides
outputs that look to the outside world like an actual potentiometer.
Thus, you control the digital pot with digital signals and the pot controls the
circuit for the motor just like with an ordinary pot.
There are some limits for these devices but many times they still work ok for
lots of types of applications.

Im sure people here can point you to some part numbers, or do a search for
'digital potentiometer'.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top