logo elektroda
logo elektroda
X
logo elektroda

ESP8266 12e - How to connect the TOWER PRO MG90S servo correctly?

gnato 5133 12
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15823634
    gnato
    Level 10  
    Welcome,

    i am designing a draft measurer for a central heating cooker that allows remote control of the ash cover via wifi, I am using an ESP8266 12e as the control unit.

    The design includes an AUTO mode, which will adjust the cooker draft based on the temperature (ds18b20 sensor). In addition, a 16x2 LCD display with HD44780 converter is hooked up to the whole thing.

    Everything is working correctly, but I have a problem with sending the appropriate signal to control the servo (TOWER PRO MG90S) - at the moment, after connecting the servo "goes crazy right and left". Most likely the problem lies in hardware rather than software, as the servo runs on 4.8-6v (electronicoscaldas.com/datasheet/MG90S_Tower-Pro.pdf) while the ESP runs on 3.3V. Due to the fact that I am not an electronics engineer and do not have measurement equipment I am not really able to deal with this problem.

    On the diagrams below I have presented a fragment of the circuit, which is responsible for the part related to the servo. At the same time I would like to point out that the whole thing is connected to the MB102 power supply module - the arduino on the diagram acts as a placeholder ;)

    ESP8266 12e - How to connect the TOWER PRO MG90S servo correctly? ESP8266 12e - How to connect the TOWER PRO MG90S servo correctly?

    I planted a NodeMCU on the ESP and tried sending the signal to the servo in 2 ways:
    - by setting an alarm every 20ms (obtaining a frequency of 50Hz) with a change of state of one of the gpio outputs (based on: roboremo.com/esp8266-servo.html)
    - by using pwm - pwm.setup(5, 50, 76) pwm.start(5) ... (based on: electronics.stackexchange.com/questions/233214/controlling-servo-motor-sg90-from-nodemcu-1-0-development-kit)

    Regardless of the method, the servo still chases like crazy right and left.
    In addition to connecting the servo as in the diagram above, I also tried additionally connecting GPIO_14 to the 3v3 supply via a 2K resistor.

    I read and searched and came across some more suggestions for using an npn transistor (to invert the signal?), but nowhere could I find any information that I could digest on how such a transistor could be incorporated into my circuit.

    If anyone would like to take a look at my case and give some factual advice I would be much obliged.
  • ADVERTISEMENT
  • Helpful post
    #2 15824565
    Anonymous
    Level 1  
  • #3 15828246
    gnato
    Level 10  
    Thanks for the answer.

    Regarding your way of measuring the wavelength using a resistor and capacitor I have 2 questions:
    - is the microphone input enough? I have a laptop without a line input.
    - i have drawn out the circuit to make sure it is laid out correctly, can you confirm that it is ok? (there was no jack plug component available, so I added a socket instead)

    ESP8266 12e - How to connect the TOWER PRO MG90S servo correctly? ESP8266 12e - How to connect the TOWER PRO MG90S servo correctly?
  • ADVERTISEMENT
  • #4 15828250
    Anonymous
    Level 1  
  • #5 15828298
    gnato
    Level 10  
    More or less, that is, if I connect such a circuit I won't burn anything? :)
  • ADVERTISEMENT
  • #6 15828308
    Anonymous
    Level 1  
  • #7 15834758
    gnato
    Level 10  
    I bought such a capacitor, will it be suitable? ESP8266 12e - How to connect the TOWER PRO MG90S servo correctly?
  • #8 15849117
    gnato
    Level 10  
    The reading came out as follows:

    ESP8266 12e - How to connect the TOWER PRO MG90S servo correctly?
  • ADVERTISEMENT
  • #9 15849167
    Anonymous
    Level 1  
  • #10 15859227
    gnato
    Level 10  
    I recorded 2 files:
    1. alarm.wav - which is the result of calling a piece of code:
    Code: Lua
    Log in, to see the code


    2. pwm.wav - which is the result of the code piece:
    Code: Lua
    Log in, to see the code


    I think I've managed to capture the correct signal at some point (I've cut out the relevant bits). The only thing that puzzles me is why the signal wasn't recording all the way through. Is it a connection issue, or is it a matter of the esp somehow losing the set signal (which seems rather impossible to me, but as I'm a beginner I could probably be wrong).

    Finally, I just wanted to apologise for the fact that my answers are rather long-winded, unfortunately this is dictated by a rather small amount of free time (work, work, work...).

    Thank you also for taking an interest in the topic and wanting to help me :)
    Greetings[/code]
  • Helpful post
    #11 15859259
    Anonymous
    Level 1  
  • #12 15870929
    gnato
    Level 10  
    I swapped as you suggested, however the servo only "buzzed" without any reaction. Nevertheless, I think I managed to solve the problem. Namely, until now I had the servo connected to the power module, while the ESP itself was connected to the arduino, which serves as my programmer.

    After connecting the servo to the power supply from the arduino, the whole thing started talking to each other correctly by using the pwm method. Moving on, I switched entirely to the power module for a moment and the communication was also working correctly.

    I was not aware that connecting different components to different power supplies could cause this behaviour. I think the topic to close, atom1477 thanks a lot for your interest in the topic and thanks for your help :)
  • #13 15870946
    Anonymous
    Level 1  
ADVERTISEMENT