Push and pull solenoid with thunderborg

Can I connect a push and pull solenoid to a thunderborg?
Many Thanks

piborg's picture

Yes, ThunderBorg can control a push and pull solenoid.

Connect the solenoid up like a standard motor, then work out the correct drive power as follows:

drivePower = solenoidVoltage / batteryVoltage

For example a 5V solenoid with a 9V battery would be:

drivePower = 5.0 / 9.0

You can then drive the solenoid as follows:

# Move one way, then turn the power off
TB.SetMotor1(+drivePower)
time.sleep(1)
TB.SetMotor1(0)
# Move the other way, then turn the power off
TB.SetMotor1(-drivePower)
time.sleep(1)
TB.SetMotor1(0)

If it is connected to M2 instead of M1 use SetMotor2 instead.

Subscribe to Comments for "Push and pull solenoid with thunderborg"