Now it's time to test the prototype #1 with the actuators.
We have realized a Arduino example, you can find it at github
Before we talk, let's watch the video:
The first think we said was: it works!
With a tiny processor, with a bunch of discrete components we are able to pilot a DIY actuators without limit switches.
This trick helps us to significantly reduce the complexity of the hardware.
Some notes about the code
// Program params
#define MAX_SAMPLES 10
#define IGNORE_SHUNT_VREF_FOR_ 1000L // milliseconds
#define MAX_SHUNT_VALUE 20 // threshold
#define MIN_VREF_VALUE 100 // below this value the external power supply (eg: solar panel) supplies too little energy
#define MAX_SECONDS_MOVEMENT 180 // max seconds to move actuator
- MAX_SAMPLES: we use an array to read analog values and give an average of the values derived from the scan
- IGNORE_SHUNT_VREF_FOR_: when motor starts, we can ignore first values
- MAX_SHUNT_VALUE: a reference value, above this value it is assumed that the motor is straining and therefore it can be deduced that it has reached the end of its stroke
- MIN_VREF_VALUE: a reference values, below this value it is assumed that external power (solar panel) produce few energy and the engine should be stopped
- MAX_SECONDS_MOVEMENT: an arbitrary value, high enough to reach the end of actuator stroke
digitalWrite(ACTUATOR_R_PIN1, LOW); digitalWrite(ACTUATOR_R_PIN2, LOW); digitalWrite(ACTUATOR_L_PIN1, LOW); digitalWrite(ACTUATOR_L_PIN2, LOW);
When program start, we put L298n pins to low.
Next, we put pin to high once at time to keep consumption low.
The result is one move at time for a single actuator.
Current absorption
As you can see on video, the circuit consumes about 0.1W with motor off and 0.2W with one motor on.
We think a good milestone has been reached!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.