I am trying to build a locking system for my robot, I want it to be realtively cheap and connected to arduino so in case the power cuts off, the locking system kicks in.
I thought of building a small electromagnet using nails(or other iron cores), magnetic wire and a battery.
I was thinking on a way on how to connect this to arduino, and I came up with the L298N driver.
So the battery would be connected through the controller and the controller would be connected to arduino.
Would this be possible? I just need to control it to turn it on/off, no change in polarity. Would the controller work without using the PWM pin on the arduino???
If this work I would need to connect around 3 or 4 of these electromagnets so 2 L298N dual controller would be great for this.
Would really appreciate your help, I am quite new to electronics and robots in general, so any advice is great for me.
I would think you'd want a solenoid. When power is available, the solenoid is energized and holds the unlocked position.
When power is lost, the spring in the solenoid moves it to the locked position.
No arduino needed, just a transistor to sink the solenoid current.
Yeah I want to make something similar, hand made solenoid, due to not having much money.
Thats what I really want but it does not have any implication with the arduino, therefore if the arduino looses power, the solenoid would still be working, the robot will keep going downhill for example.
Thats why I want to connect it through the arduino.
Well, you can control the transistor however you want. Arduino HIGH output turns the transistor on, energizes the solenoid to unlock the robot. Arduino LOW output (or resistor to pull signal low when Arduino loses power) de-energizes the solenoid and locks the robot.
Could you give me a general idea on how to do this connection?? as in sketch if you can.
Coming back to my question of the L298N dual controller, it would not work?? it seems to be really simple, no additions (components) and relatively cheap.
Hello, could anyone help me out??
I guess there is no reason not to use the L298N, but I would consider simple transistors instead or a Darlington Array.
If you do use the H Bridge you will need to hold the Enable pins high (tie to VSS) and then just switch the 4 inputs to control the outputs.
Alternatively pull the Inputs high and switch the Enables, but as each Enable controls 2 Outputs they will switch two solenoids each.