Driving Two motors by Bolt though L298N without Arduino

I would like to drive TWO DC motors of the car. Front have gear to turn the car to LEFT or RIGHT depending on the HIGH/LOW signals to L298N pins. Back motor can take car to FORWARD or REVERSE depending on the rotation.
There are 5 digital Pins and One Analog. Is it possible to drive two motors through Bolt directly using L298N? Giving required signals from digital pins for clockwise and anticlockwise rotation of motors and supplying PWM signals from A0?
Will following code will drive the motor?

<button onclick=“digitalWrite(0, ‘HIGH’);” “analogWrite(A0, ‘200’);”>FORWARD

Hi @prakash52kar,

I am inviting @vinayak.joshi . He will help you out by tomorrow EOD.

1 Like

Hi @prakash52kar,

It is definitely possible. (Except for the part of supplying PWM signal using A0, which is not possible).

You will have to setup the L298N motor driver to use 3.3v as control voltage. Next have the enable pins of the driver connected to 3.3v.
Connect each control pin of the motor driver to 1 digital pin of the Bolt WiFi module.

Use appropriate diodes and connect the motors to the outputs of the L298N. You will then be able to use the remote API such as digitalWrite and digitalMultiWrite to control the 4 digital pins.

You can also use analogWrite on these digital pins to set the PWM value on the pin.

@vinayak.joshi Sir,
If I want to connect only 1 dc motor to L298N with Bolt module without Arduino, is speed control possible?

Yes possible. To run DC motor with L298N there requres three connections. In L298N you will see two jumpers one at left and other at right of the four Pins used to drive two motors (positive-negative-positive-negative). You need to remove these jumpers and give HIGH from one of the bolt pin. These pins are used to enable L298N to run motors in PWM mode. Now from program increase the speed in steps. Hope you understand.

Hi @swethatsunil.mec,

Building on @prakash52kar’s response, you will have to use the digitalMultiwrite feature to set the digital states of 2 of the 3 pins. Here is a link to the documentation

Also, you will have to use analogWrite on the 3rd pin (you can use any of pins 0,1,2,3 or 4. Do not use A0 for this). Here is a link for analogWrite.

@vinayak.joshi Dear Sir,
Will this solve the problem mentioned in the following post ?
https://forum.boltiot.com/t/dc-fan-speed-control/14711/3?u=swethatsunil.mec

Hi @swethatsunil.mec,

I have replied to the query in the thread.

Can you provide the proper circuit diagram for the same to understand and implement it without damaging components.