Incase you don't know, (or i haven't mentioned it,) we actually have an issue with the compass sensor. The compass sensor we currently have won't actually work. Because it uses magnets, it will receive interference from the magnetic (brushless) electric motor. We are actually unsure if this is going to be a problem, but either way we need some type of backup. What we ended up doing was seeing if the GPS could see its heading. It actually could see its heading even at walking speeds. We tested this by walking around our neighborhood while carrying the arduino. If the arduino can get this heading from the GPS module, then we could use this to code the rudder to steer the boat.
1 Comment
The thing we are most nervous about is the propeller shaft running out of grease... The grease has an extra purpose: To keep the water from coming up the shaft and flooding the whole boat... It does the same things as normal grease too, such as protecting the shaft from wearing out. But this grease only lasts so long and when it runs out? The arduino will wish it had a bathing suit. So we went to buy some grease... It turned out to be blue... so then we started testing it by, of course, greasing it all up we readied the boat up with some pliers to account for the added weight of solar cells and a sat-phone, and put it into a large lake (the tub) and left it for 30 minutes. The motor stopped when the battery ran short... It worked out though We did it a second time. It lasted 1 3/4hours. Long story short, The boat was fine. The shaft? Oh, yeah... It seemed, "different". the grease turned dirty and milky and was a gray-green color and The rest of the shaft was almost out of grease. We need this to last a week... That won't work... So we have some ideas like making a silicone seal or using an o-ring... We also thought about an arduino pump or making the compartment sealed so the water can't get in... We will see! We separated the code into an ESC calibration program that only needs to run once, then a durability test program. The slowest the propellor would turn was when the power level was 27 degrees. Not sure why this is... 27 degrees on a scale from 0 to 180 is 15% power, but the motor doesn't turn at lower power levels than that. Here is the code for the calibration program: #include <Servo.h> /* * 1. Set the throttle trim and sub-trim to neutral or zero. * 2. Move the throttle stick to full throttle, turn on the transmitter. * 3. Plug the ESC to the Receiver, then Plug the battery to ESC. * 4. After 2 seconds, it will have 2 short beep, than pull down the Throttle Joystick to the down position. * 5. Unplug the battery, restart the ESC. * * download to Arduino and plug in battery. After two seconds and two beeps, power D0 pin to 5V, then unplug battery * it appears that ESC1(27) is the lowest speed the motor will turn at based on this calibration. * Any program MUST write a zero value to ESC1 in setup to guarentee the ESC is not recalibrated */ Servo ESC1; // create servo object to control a servo Servo rudder; // create servo object to control a servo int throttle = 0; // variable to store the ESC throttle setting -- max 180, min 0 int pos = 60; // variable to store the servo position int val = 0; // variable to store the read value of pin d0 void setup() { rudder.attach(10); // attaches the servo on pin 10 to the servo object ESC1.attach(9); // attaches the servo on pin 9 to the servo object pinMode(0, INPUT); // sets the digital pin 0 as input so it can be used as a switch ESC1.write(180); // calibrate ESC -- max throttle immdiately upon waking up } void loop() { val = digitalRead(0); // read digital pin 0 while(val=1){ ESC1.write(0); // calibrate ESC -- min throttle for 2 seconds delay(500); } } Here is the durability program. It runs the motor at 27 degrees (on a scale from 0 to 180 degrees) then cycles the rudder once a minute: #include <Servo.h>
/* this program assumes the ESC has been calibrated */ Servo ESC1; // create servo object to control a servo Servo rudder; // create servo object to control a servo int throttle = 0; // variable to store the ESC throttle setting -- max 180, min 0 int pos = 60; // variable to store the servo position void setup() { rudder.attach(10); // attaches the servo on pin 10 to the servo object ESC1.attach(9); // attaches the servo on pin 9 to the servo object ESC1.write(0); // write 0 to ESC to avoid recalibrating delay(8000); // delay to get everything powered for (throttle = 0; throttle <= 27; throttle += 9) { // goes from 0 degrees to 180 degrees - throttle blip appears to initialize ESC, 27 degrees ESC almost 0 power ESC1.write(throttle); // tell servo to go to position in variable 'throttle' delay(2000); // waits 20ms for the servo to reach the position } for (throttle = 36; throttle >= 27; throttle -= 3) { // goes from 180 degrees to 0 degrees ESC1.write(throttle); // tell servo to go to position in variable 'throttle' delay(2000); // waits 20ms for the servo to reach the position } } void loop() { throttle = 33; ESC1.write(throttle); // provide low power to ESC delay(60000); // move rudder once per mintute for (pos = 60; pos <= 120; pos += 1) { // move rudder from 60 to 120 degrees // in steps of 1 degree rudder.write(pos); // tell servo to go to position in variable 'pos' delay(10); // waits 10ms for the servo to reach the position } for (pos = 120; pos >= 60; pos -= 1) { // move rudder from 120 to 60 degrees rudder.write(pos); // tell servo to go to position in variable 'pos' delay(10); // waits 10ms for the servo to reach the position } } |
AuthorMalachi and Ezra's page where we build cool stuff and either break it, set fire to it, etc. in the name of science. Archives
August 2019
Categories
All
|