-1
\$\begingroup\$

Searching on web for make h-bridge to forward and backward dc motor with ic 555 by microcontroller ESP8266 GPIO (PWM), i found some helps and i did this circuit:

enter image description here

enter image description here

This circuit always stay with +3.95v (this voltage not matter now because i will increase later with a power boost IC) and, when the gpio pin send a signal, the voltage go to -3.95v.

The question is i need a circuit that start with 0v and two gpio pin's conected. Then when one pin send a digital signal, this circuit stay positive voltage and when other pin is acioned (alternativly), this circuit stay negative voltage. When both gpio do not send signal, the circuit back to 0v.

Anyone can help me?

Thank you!

Components list:

  • 01 DC Motor 12v;

  • 02 IC 555;

  • 01 ESP8266 (NodeMCU);

  • some wires;

Simple code for test (Arduino IDE):

const int pinoHorario = 13, pinoAntiHorario = 14;

void setup()
{
        Serial.begin(115200);

        pinMode(pinoHorario, OUTPUT);
        pinMode(pinoAntiHorario, OUTPUT);

        digitalWrite(pinoHorario, LOW);
        digitalWrite(pinoAntiHorario, LOW);
}

void loop()
{
        digitalWrite(pinoHorario, HIGH);
        delay(3000);
        digitalWrite(pinoHorario, LOW);
        digitalWrite(pinoAntiHorario, HIGH);
        delay(3000);
        digitalWrite(pinoAntiHorario, LOW);
        delay(3000);
}
\$\endgroup\$
  • 2
    \$\begingroup\$ This makes no sense. A 555 is not an H bridge. \$\endgroup\$ – Chris Stratton Jun 11 '18 at 4:29
  • 1
    \$\begingroup\$ Please draw the circuit.it is difficult to decode using fritzing diagram \$\endgroup\$ – Umar Jun 11 '18 at 4:31
  • 2
    \$\begingroup\$ Why do they have to be 555s? \$\endgroup\$ – user253751 Jun 11 '18 at 5:57
  • 2
    \$\begingroup\$ Because they are only IC's that i have here now, @immibis. I read about L293D and i saw that this is the better choice for do that. But i don't have this component now. \$\endgroup\$ – Cayo Fontana Jun 11 '18 at 6:01
  • 1
    \$\begingroup\$ The L293D is also a horrible choice, though at least a few decades ago before there were better options it was at least intended for driving motors, something the 555 most definitely never was. \$\endgroup\$ – Chris Stratton Jun 11 '18 at 17:18
4
\$\begingroup\$

A classic example of 'if your only tool is a hammer, then every problem looks like a nail'. A 555 isn't the obvious choice for a motor driver, but as its output is good for +/- 200mA, and it can be rigged as an inverter, why not?

At the moment, you've got a diagram that gives you only forwards and back. The second 555 takes its input from the output of the first.

Change it so the second 555 takes its input from a second GPIO. Then you have independent control over both lines. Now programming either '00' or '11' give you 0v on the motor, '01' and '10' give you forward and back.

schematic

simulate this circuit – Schematic created using CircuitLab

Now who would have thought that CircuitLab had a 555 symbol ready to use? OK, it's not a good one. If you don't have inputs on the left and outputs on the right, then a facsimile of the pin positions is preferable to random, though if I squint I can see some pin positions. At least Vcc is top and GND is at the bottom.

I've learnt something today! Here's a link describing the use of a 555 as a power inverting buffer. A nice feature is that it's claimed to have high hysteresis, based around its 1/3rd and 2/3rds switching thresholds, retaining its current state when the input voltage is in the middle third.

A comment on your code. While yours economises on writes to get the three 00, 01, and 10 states, you are debugging, where readability and certainty is everything, and efficiency is not necessary. I would be more inclined to write the loop as

void loop()
{
        digitalWrite(pinH, HIGH);
        digitalWrite(pinAH, LOW);
        delay(3000);
        digitalWrite(pinH, LOW);
        digitalWrite(pinAH, HIGH);
        delay(3000);
        digitalWrite(pinH, LOW);
        digitalWrite(pinAH, LOW);
        delay(3000);
}

being explicit about the full pin state before each delay statement. I can see at a glance what the pin state should be, I don't have the workload, or the potential error, of flogging through the program logic to see what's still set from last time.

Long variable names offer too many chances to mistype the name, shorter ones are easier to proof read. So many times I've copy/pasted code from elsewhere, and wasted so much time because I've not changed all the names I should have, and not spotted it because they were so long and plausible looking. For production code of course, long descriptive names rule, but this is debugging!

\$\endgroup\$
  • \$\begingroup\$ Thank you for reply, @Neil_UK. I tried it before but do not inverse voltage. On the multimeter, the voltage does not negative for one or other gpio. Always positive for both. But maybe on DC motor this can work by polarization. I don't have a dc motor here now. Tomorrow i will go to university and there i will test on DC motor. Do you have any ideia about why now, in my multimeter, the voltage not altern when one or other gpio send a signal? Thank you! \$\endgroup\$ – Cayo Fontana Jun 11 '18 at 5:30
  • 1
    \$\begingroup\$ If measured with respect to ground, the voltage of each GPIO and each 555 output will always be positive or zero, +/0. It's only when you measure the voltage between the two outputs that you get +/0/- values. Try measuring the voltage between two GPIOs (only with DMM, not with motor), that will also give you +/0/-. If you get the +/0/- options between your GPIOs, and don't get those three options between your 555 outputs, then at least one of them is dud, or incorrectly wired. \$\endgroup\$ – Neil_UK Jun 11 '18 at 5:35
  • \$\begingroup\$ please see the test code (initial post updated). \$\endgroup\$ – Cayo Fontana Jun 11 '18 at 5:35
  • \$\begingroup\$ Assuming the obvious pin connections, that code should spend 3 seconds in each of forward, back, and not running. With nothing else connected to the two output pins, measure the differential voltage between them with your DMM, that is put one meter probe on H(13), and one on AH(14). Do you measure 3 seconds each of +ve, 0 and -ve differential voltage? If so, your code, nodeMCU and breadboard are fine. Now add the 555 power buffers, and measure between their outputs. If not right, measure at input and output of each buffer and see which one is not working. \$\endgroup\$ – Neil_UK Jun 11 '18 at 5:42
  • \$\begingroup\$ kkkkk... thank you for your patience, @Nail_UK. SINCE YESTERDAY i tried exactly what you said for i do (bacause seems obvious sense) and didn't work. Do you know why? Why i connected the wire on pin D6 (12) but on my code a use pin D5 (14)! Sorry for very bad mistake and sorry for take up your time! I mark your post as answer! Thank you!! \$\endgroup\$ – Cayo Fontana Jun 11 '18 at 5:51

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.