I have simulated a PWM motor control circuit in Proteus, now I want to bring it to life and connect a circuit in real world.

Here's my PWM circuit in Proteus:

enter image description here

And the code:

unsigned int duty_50;

void main(){
      ADPCFG = 0xFFFF;// initialize AN pins as digital
      PORTB  = 0x01;
      TRISB  = 0;     // initialize portb as output

      duty_50 = PWM1_MC_Init(5000, 0, 0x01, 0); // Pwm_Mc_Init returns 50% of the duty

      PWM1_MC_Set_Duty(duty_50, 1);


In simulation, this circuit works fine,

enter image description here

And I already bought the components I need:

1.dsPIC enter image description here

2.L293D driver IC

enter image description here

3.DC Motor(Which needs 1.5V and 120 mA)

enter image description here


enter image description here

I want to use these components and power supply machine to connect these components in real world, but I don't know if there might be problems. Is there something I should pay attention to before connect the real circuit so that I won't make some mistakes and burn some components?

  • 3
    \$\begingroup\$ If you don't burn stuff, you don't learn stuff. \$\endgroup\$ – Anindo Ghosh Jun 14 '13 at 15:32
  • 2
    \$\begingroup\$ Great job! But this is stepping up a few floors once. I think you should start by breadboarding some LEDs with the microcontroller. Perhaps, you should do a little research on breadboarding. Such as this one. \$\endgroup\$ – abdullah kahraman Jun 14 '13 at 15:44
  • \$\begingroup\$ How much current is going to go to the motor vs. how much is the breadboard rated for? General suggestion: always double-check where the power rails are going to and that they are the right way round before connecting. \$\endgroup\$ – pjc50 Jun 14 '13 at 16:33
  • \$\begingroup\$ Don't forget you need 0.1 uF bypass capacitors across the power supply rails at each power connection for every chip. \$\endgroup\$ – Connor Wolf Jun 14 '13 at 22:46

Yes, there are things you should notice. Unfortunately, is boils down to "you should have a complete knowledge of electrical engineering." So instead, I will offer two pieces of advice:

  1. you will necessarily break some things in learning
  2. use a current-limited power supply to reduce the number of things you break

A current-limited power supply is one that supplies as much electrical power as it can, without exceeding limits you set for voltage and current. Usually, the supply operates at the voltage limit you set (say, 5V). When you make a mistake and short out the supply, an ordinary power supply will dump as much current as it can into your circuit to try to maintain a 5V output, thus vaporizing your stuff. A current-limited supply will reduce the output voltage to avoid exceeding the current limit you set, thus your stuff may merely get warm rather than being vaporized, allowing you to clear the fault and try again, without another trip to the store to buy a new microcontroller.


protected by clabacchio Jun 14 '13 at 17:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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