NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Sensors, Actuators, and Robotics » Use digital signal to control motor through analogue circuit

October 09, 2011
by Asuhler
Asuhler's Avatar

I have a problem on my hands. I need to take an input provided by a potentiometer and use it to provide an output originality designed for the potentiometer. I'll give you the context: Motor control. I know this issue has been explained a million times over, but I can't find an answer to my digital to analogue problem.

The input from a potentiometer is easy, I just used the tempsensor code for that. The analogue circuit is basically a pnp and npn with connected gates being controlled by a potentiometer, but I need the micro controller to act as the pot. I know there are easier ways of controlling a motor, but I need to use the motor as a proof of concept for analogue and digital circuits working together for a much bigger project.

I don't have any code that deviates from the tempsensor project yet, so there are no code screenshots. I would like a BASIC explanation of I/O on the micro controller in relation to my purpose, how the code correlates to the I/O related to this project, how to make the micro controller read voltages, and how I could make the analogue circuit respond. Code examples would be EXTREMELY helpful. If you haven't noticed, I'm fairly new, and a lot of concepts go right over my head.

Photos of the controlling circuit and my actual setup are found here.

Analogue circuit layout

Nerdkit setup using tempsensor setup

Full analogue circuit

October 10, 2011
by missle3944
missle3944's Avatar

Hi Asuhler,

I think you will find what you are looking for right here. It is a tutorial on how to use pwm with your nerdkit microcontroller to control the speed of the motor. Driving it is one or two mosfets I believe. I tried using the 2n7000s included but they wouldnt really work. So hopefully you have some stronger transistors to use. All you have to do is replace the tempsensor with your pot and it should work great! Hope this helps.

-Dan

October 10, 2011
by Asuhler
Asuhler's Avatar

Dan-

Thanks for responding! Unfortunately, a lot of this went over my head the first time I saw that tutorial. I also missed the example code download. That might have been helpful to know BEFORE I posted :) Now I have a different question.... you probably have a tutorial that will help, but i haven't found the answer in it yet.

So, as I said in my first post, this is more of a proof of concept for my programming and interfacing skills between digital and analogue circuits.

The main project I plan to do is taking a solar array that I built and doing everything from running motors to charging batteries using it. Obviously, the amperage from a large solar array might be too high for the microcontroller, so the next thought was using a control/regulating circuit to cut amperage between the solar cells and the microcontroller.

From there, I need to read the voltage, use an external circuit to modify the voltage, and use the microcontroller to control the selected voltage through that external circuit to the battery, or motor, or ect... Two questions come to mind. How do I make a circuit that provides information on voltage accurately, and how do I regulate amperage coming into the microcontroller, not just the voltage? (the amperage coming in doesn't need to be controlable, just needs to not overload the microcontroller)

The external circuit is not hard to figure out if someone can point me in the general direction of what kind of circuit to use. I can google or find plans for the circuit.

Any ideas?

October 10, 2011
by missle3944
missle3944's Avatar

Ashler,

I'm not too experienced here, but I think from a little research you could buy a solar charge controller and then build a dc variable power supply along with using your mcu to read out a digital display or something similar. I found some cool DIY bench top power supplys on instructables like this one here. They used a computer powersupply for a dc converter. As far as the solar stuff goes I don't really know. Possibly one of the veterans can help here.

Though my Dad is thinking of buying a Solar Panel outfit for his Ham radio to operate in case of emergencies becuase we just had a huge power outage here in san diego and it was very hard to communicate. But the Hams were still talking becuase of backup battery from solar possibly.

-Dan

October 12, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Asuhler,

PWM is a very important concept to know and understand, if the ideas went over your head definitely try watching the video again after letting the ideas soak in after a while, and if you have questions, ask them, we are happy to help.

With something like a solar cell you are usually charging up a battery to store charge for later use. If you have that setup, all you need to do is make sure you regulate the voltage from your battery down to 5V and then you can run the microcontroller off of that. Remember that batteries can be able to deliver alot of current also (car batteries can certainly deliver enough to harm people), so be very careful when using these sorts of power supplies. Build all your circuits with 9V batteries first, and then integrate the big power supplies when you are certain everything is working.

Humberto

Post a Reply

Please log in to post a reply.

Did you know that our USB NerdKit comes with everything you need to get started with microcontrollers? Learn more...