This is my first post so please be gentle.
I have never coded before but have project to have automated control of an outboard throttle for test purposes ie
0% of throttle for 5 minutes
25% for 10 mins
100% for 60 mins etc
Back to 0%
The parts I have are
Arduino Uno (12v power supply & USB cable)
Actuonix L12-I Micro Linear Actuator with Internal Controller
Jumper cables etc
PC is running Windows 10
My idea is to set up the travel of the actuator (around 70mm (of the 100mm available length)) so it equal's the throttle's max travel (100%) therefore once programmed I can alter the time/throttle% to suit any test programme we want to run
The actuator has a PWM or 0-5V input so thought about that to control distance with the position output from the actuator as feedback to controller
I hope this is enough info for some one to give me the basics to be able to complete this project
Cheers
Justin
Have you given any thought on how you may need to handle fault conditions, such as over temperature from loss of cooling water, over rev from loss of load such as throwing a prop or emergency shut down for any personell dangers that may arise..??
For basics of your original you might want to look at how to control a servo within the given parameters using timers.
Safety issues are all covered via instrumentation logging alarms, ECU o/p's and cell safety systems, it's just the physical control of the throttle cable I need help with
Often, you can control linear actuators like a RC servo and that appears to be true of the one you have depending on how you wire it up. Arduino has a servo library and there are some examples that come with the IDE such as sweep which should get you started.
You will need a separate power supply - the Arduino can control the actuator but it can't provide enough current to actually drive it. Connect the power supply ground to the Arduino.
Thanks for the pointer
I have copied a programme that is controlling my actuator and I can change the duty cycle (actuator length) and time delay. Whoever this is in the form of a loop and I want the actuator to return to zero and stop ! If I remove the loop or enter break to try and stop the loop command all I get is errors, any ideas ?????
Hi wildbill, thanks for your input
I have copied the programme (below) I am currently using which gives me control of distance and time (please don't ask what the other stuff does as I have no idea !)
I have tried entering the boolean commands in various places but it keeps giving me errors, any chance you can have a butchers to change the loop part so it stops when the last zero position is reached
Also I would like to have an external run button (momentary switch to start programme) with an led illuminated while the programme is running and from what I have read this may be achievable with the boolean code but I have no clue how.
The hardware side of things isn't so much of a problem (5v (pulldown 10K resistor I believe) via switch to pin 2 then an output to the led and ground)
If you can help in any way that would be awesome
const byte OC1A_PIN = 9;
const word PWM_FREQ_HZ = 20000; //Adjust this value to adjust the frequency
const word TCNT1_TOP = 16000000/(2*PWM_FREQ_HZ);
const int buttonPin = 2; // the number of the pushbutton pin
Please read the post at the start of any forum , entitled "How to use this Forum".
OR http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hey Tom
Sorry about that I couldn't find how to do the scrolling window !
Here is a pic of the circuit of which the actuator control (distance and time) works fine.
I haven't wired the momentary switch (start test) or LED (test running) up yet but that's how I see the circuit working once I get rid of the loop ??
I've got a jpeg but can't attach it as 'insert an image' wants a URL (not doing very well really) ?
bool Run=true;
void loop()
{
//Add Start switch That sets Run to true again
if(Run)
{
setPwmDuty(0); //Change this value 0-100 to adjust duty cycle = mm of actuator travel.
delay(10000); //Time in mS (60,000mS = 1 minute)
setPwmDuty(25);
delay(10000);
setPwmDuty(75);
delay(10000);
setPwmDuty(0);
delay(60000); //Needs to turn OFF not loop????
Run=false;
}
}
waxxer:
I've got a jpeg but can't attach it as 'insert an image' wants a URL (not doing very well really) ?
You attach it to the post, don't try and insert it.
If you are using "Quick Reply", click "Preview", then under the text box you will find the attachment facility.
The editor will automatically insert it when you "Preview" again or post the post.
Tom...
I cant upload my jpg for some reason it starts downloading but never gets past 2% then sends me an error message.
Basically the wiring is
240Vac to 12Vdc to board and actuator
Pin 9 is PWM o/p to actuator
Next I want to add a
momentary switch from 5v on the board to pin 2 (to run the programme)
LED from pin ?? to ground (with a 10k pull down resistor I believe) to be on while programme is running
I hope this is enough info
Hi,
Worked that time.
Is the 12V for the actuator motor running through the UNO board?
If so, that is a bad move, the current for the motor will be running through the PCB tracks of the UNO, and they are not designed for current like your actuator would be drawing.
Connect the +12V and its 0V directly to the 12V power supply.
Your LED also needs to be turned around and a series current limit resistor fitted.
Also a fuse in the 12V line at the power supply would help in case of problems.
Excellent thanks chaps
I will get the mod's sorted
Does it matter which pin I use for the LED (only reason I have pin 2 for the switch is I saw it on another circuit) or are they programmable for in/out V/pwm etc
I will have a go at writing the code for the switch/LED but will probably need some more help later in the week !
Justin
Instead of returning the actuator to zero at the end of the routine, could you use an "if else" condition to determine the position of the actuator? For instance, something like:
int inPin = 7;
int val = 0;
void setup(){
pinMode (inPIn, INPUT);
void loop(){
val == digitalRead(inPin);
if (val == 1) {
setPwmDuty(0); //Change this value 0-100 to adjust duty cycle = mm of actuator travel.
delay(10000); //Time in mS (60,000mS = 1 minute)
setPwmDuty(25);
delay(10000);
setPwmDuty(75);
delay(10000);
val = 0;
}
else if (val == 0) {
setPwmduty(0);
}
I'm still learning Arduino coding myself so my syntax may be off or things may need to be altered but that's how I'd write it using ladder logic. Read the state of an integer and that value would dictate work flow and nothing else will happen until integer is reset back to 0. All the other stuff about commanding the actuator I don't quite know but I thought I'd help in the limited way I can with the sequencing.
Hope this helps you and best of luck on your work.