HW-130 Motor Driver & Arduino Uno

Post and discuss new components that you have created.
Post Reply
mnfisher
Valued Contributor
Posts: 1276
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 122 times
Been thanked: 643 times

HW-130 Motor Driver & Arduino Uno

Post by mnfisher »

I needed a motor driver for a small project - and the HW-130 board was a cheap option to get acquainted with the L293D driver chip.

The board is cheap (see https://www.amazon.co.uk/dp/B0CVX4ZKFV? ... asin_title ) and offers the ability to control servos, DC motors and stepper motors.

There doesn't seem to be a lot of info about it (but it is a clone of the long defunct Adafruit motor driver board v1)

So - working from the Adafruit code - I came up with this code - that allows the Arduino run up to 4 DC motors or two steppers. I considered adding the servo driver, but in the end just use the FC component (the servos are on pins D10 and D9)

The motors re driven by the L293 chips - but the selection of the motor is via a port expander (SN74FC595N)

Because what I really needed was a way to drive a solenoid (surely a simple motor?) - I also added routines to either pulse single or multiple solenoids.

The macros to use are:

Initialise() // Sets up the relevant pins to a known state.
MotorEnable / StepperEnable /SolenoidEnable - initialise an output port (M1 to M4 or S1 / S2) as aDC motor / stepper / solenoid
MotorSpeed / StepperSpeed - set the relevant speed
MotorRun / StepperStep - Run the motor (forward/backward/stop) Stepper (no of steps and mode)
SolenoidPulse / SolenoidsPulse - activate a solenoid or solenoids (bits 0..3 correspond to ports 1..4)

Note that the enable routines set the speed to 0 - so set speed must be used before running a motor.

The Adafruit code was quite long - and I simplified it by removing support for the Arduino Mega and PIC32 - the Mega would be easy to add back (the pins are different)
The PWM is coded in C - and probably should use the FC component.
The Adafruit code had many 'if then' options to choose the coils - but I simplified this by using lookup tables for the various pin states. To maintain compatibility with the board labelling - the 'ports' are numbered 1..4 (and this necessitates a few of '-1's in the code to match arrays)

I feel the board would also work as an LED driver - using PWM to dim the LEDs - and might have a play.

Any one any experience with steppers etc - I ran the output (particularly for the microstepping) on an oscilloscope - and although it seem to match the AF code output - my motor at least doesn't seem to have much torque when using microstepping.

Note - you must use an external PSU for the motors / solenoids and things can get quite 'warm' - some heatsinks would be a good idea (apparently it is possible to solder a second L293D on top of the current ones to double current capacity)

Solenoids - are just a coil - so it is a good idea to keep the pulse short - I found 100ms worked well (and with a delay between actuations stayed cool - the ones I tested are 12v 300ma which should be well within the drivers capabilities - but they reached about 60C (as did the solenoids) on rapid actuations.
One solenoid shook itself to bits - make sure everything is tight (and add some Loctite?)

Note that the servo motors are powered by the Arduino 5V supply - so it is limited to small servo-motors without some modifications to the board / servo wiring.

Anyone - any thoughts / comments.

The 'fcfx' file here has a motor on port 1 that runs forward / back / stops whilst a stepper runs on stepper port 2. There is a simple demo using the component to do the same thing...
- One thing I don't particularly like is that dc motors use 1..4 and steppers 1 and 2.

The component can be found in Development (search for motor) as HW-130

Some of the names needs revision...

There is no simulation :-(

I'll probably use something like https://www.amazon.co.uk/dp/B07XJSMLGQ? ... asin_title although I have some high current driver boards to hand too.

Martin
Attachments
HW130.fcpx
(5.26 KiB) Downloaded 125 times
HW130.fcfx
(61 KiB) Downloaded 119 times
HW!30Test.fcfx
(10.8 KiB) Downloaded 112 times

jgu1
Posts: 724
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 611 times
Been thanked: 164 times

Re: HW-130 Motor Driver & Arduino Uno

Post by jgu1 »

Hi Martin!

Thank you for sharing. I have used the L298 with Arduino and FC10 for my project Lawnmover, they work perfect, with PWM, forward, reverse and brake. For the knife I use these 43A module:

https://www.ebay.com/itm/386880520451?_ ... BM9MOvm-9k

Br Jorgen

mnfisher
Valued Contributor
Posts: 1276
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 122 times
Been thanked: 643 times

Re: HW-130 Motor Driver & Arduino Uno

Post by mnfisher »

Thanks Jorgen,

Do you have some footage of project 'Lawnmower' in action?

Martin

chipfryer27
Valued Contributor
Posts: 1367
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 330 times
Been thanked: 475 times

Re: HW-130 Motor Driver & Arduino Uno

Post by chipfryer27 »

Hi Jorgen

Video please of your machine in action :)

Regards

jgu1
Posts: 724
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 611 times
Been thanked: 164 times

Re: HW-130 Motor Driver & Arduino Uno

Post by jgu1 »

Hi both!

It’s vintertime here in Denmark at the moment :lol:

I will make a short movie, during the next week. This is some old machine I got from a friend, the stearing, control board was blowing, so I removed
All the board and build in an Arduino Mega and some of the motor board to drive the wheel and knife. I also make a perimeter loop.

https://www.instructables.com/DIY-Perim ... nd-Sensor/ I modified the receiver so instead of using the analog input I rectified the incoming signal and use these as digital. And on the machine is some “attach” switch also.

At the moment I have two machine which up running , but still not so fancy as original, I want them to find the charger station when they run out of battery, and when I start them, I want them to start cutting the edge of the grass, etc. Still working on them ;)

I have now two up running at the moment, I can start them and leave them without problem, they run as long they have power :D
These two machine is with brushmotor, but I just get a big mashine (defect controlboard too) with BLDC motor which I hope is up running in the spring.

Br. Jorgen`

Post Reply