RC model LM298N+SG90

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ilguvat
New user
Posts: 3
Joined: 07 Nov 2024, 13:07

RC model LM298N+SG90

#1 Post by ilguvat » 07 Nov 2024, 13:51

Hi!

A couple of years ago I converted an RC model from a regular remote control to Wemos d1 mini + LM298N + SG90 via my Blink server controlled from a smartphone.
Now I’m thinking about converting it for two ESP modules connected to each other via ESPEasy p2p.
I can’t find Servo in any of the latest Collection projects for the ESP8266, for connecting the SG90 - here on the forum they recommended looking in Collection A, but there’s nothing like that there. In the Collection projects there is only "Motor - Wemos/Lolin Motorshield" and "Motor - Adafruit Motorshield v2"

Where can I find Servo support? Please indicate in full the name of the project. Also interested in how to connect LM298N, which project supports it!?

I want to assemble the transmitter (remote) on ESP32WROOM+HW504, and leave the machine as is - on Wemos+SG90+LM298N

User avatar
Ath
Normal user
Posts: 4002
Joined: 10 Jun 2018, 12:06
Location: NL

Re: RC model LM298N+SG90

#2 Post by Ath » 07 Nov 2024, 21:29

For most of the ESP8266 builds, especially the Collection builds that all have LIMIT_BUILD_SIZE compile-time flag set, the Servo support has been disabled for size reasons.

Your best alternative is using an ESP32 of some form, we have support for ESP32 (Classic), ESP32-C3, ESP32-C6, ESP32-S3, and also ESP32-C2 and ESP32-S2, but these last 2 seem to have some silicon issues, causing all kinds of small unexpected behaviors. Both have good working successors (C3 and S3).
For all ESP32 builds Servo support is included.

AFAICS, you should be able to use the LM298N motor driver with a Collection A or Collection D build (or a MAX build, when using an 8MB or 16MB Flash ESP32), as these builds include plugin P098 - PWM Motor, that has (surprise :?) support for PWM controlled motors, with optional end-switch support, to make life easier.

NB: It is possible to create a Custom build, including just the plugins and features you need, as documented here
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 4002
Joined: 10 Jun 2018, 12:06
Location: NL

Re: RC model LM298N+SG90

#3 Post by Ath » 07 Nov 2024, 22:21

I've done a little investigation, and most likely the Servo feature can be re-enabled for most builds that have it now disabled.

Opened PR #5154 that will be available form this Actions run (You'll need a (free) Github account and logged in to be able to download from there)
/Ton (PayPal.me)

ilguvat
New user
Posts: 3
Joined: 07 Nov 2024, 13:07

Re: RC model LM298N+SG90

#4 Post by ilguvat » 08 Nov 2024, 08:54

Ath wrote: 07 Nov 2024, 21:29
For all ESP32 builds Servo support is included.
Here is an example on my ESP32 - no Servo. (sorry, I don’t know how to insert pictures)
About LM298 I understood how to act.
<a href="https://ibb.co/ChW4txj"><img src="https://i.ibb.co/bz7Y3p4/fghjdj.jpg" alt="fghjdj" border="0"></a>

Image

TD-er
Core team member
Posts: 9348
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: RC model LM298N+SG90

#5 Post by TD-er » 08 Nov 2024, 09:01

There is not a specific Servo plugin.
You need to use commands to address a servo:
https://espeasy.readthedocs.io/en/lates ... motor.html

This is when it is directly connected to a GPIO pin.
The LM298N is a motor driver board, not a servo driver.

A servo is controlled by sending a PWM pulse to it.
From the top of my head, the pulse must be between 0.5 and 1.5 msec long and the actual duration determines the rotation angle of the servo.
So typically a servo controller sends a pulse every 20 msec (50 Hz).
However since you only use about 1/20 of the full period, the normal "pwm" command is unusable.
The servo commands set the PWM feature to a different resolution so you can control the servo position with more steps.

The PWM motor controller plugin is intended to be used with the LM298N (or similar DC motor drivers)

ilguvat
New user
Posts: 3
Joined: 07 Nov 2024, 13:07

Re: RC model LM298N+SG90

#6 Post by ilguvat » 08 Nov 2024, 11:19

that is, you don’t need to look for it in devices. just connect to the GPIO and write the code in the Rules?

TD-er
Core team member
Posts: 9348
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: RC model LM298N+SG90

#7 Post by TD-er » 08 Nov 2024, 11:29

Yep and to test if it works, you can just enter the servo commands via the command field on the tools page

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests