I used Adobe Illustrator to design the brackets and motor mounts and then cut out cardboard prototypes on my Cricut to check the look and fit. Once I was happy with the design i would transfer the profile to acrylic and cut it out. Below are some of the parts. The motor mounts are actually discarded aluminum serial plates that I repurposed into mounts. They slide into the PVC pipe and hold the motors in the center. I have a automotive back-up camera as my main camera and a GoPro mounted for better quality footage. The front dome is a piece of acrylic heated up in the oven and then put in a home made fixture to allow it to bow out when compressed air was applied. It took a couple of times to get the temperature right and it worked but I could have used one more shot at it.
It's been a fun project and I'm looking forward to warmer weather to test the seals all around and then do some actually under power tests. I've been posting some photos and code in another section and it was suggested to start a new thread with my photos & code in an effort to get some further help.
I started with a PWM code using the repurposed joysticks and attempted to at least get the front thrusters working and under control before moving onto the the others. It was coming along fine but I started to get worried that I would run out of wires in my CAT 6 cable for thrusters, camera and other sensor communications and then I read about RS-485. I ordered the 485 boards for the Arudino Uno's and found an example to control a servo using a potentiometer then modified it for the joysticks but can't seemed to understand how to send multiple commands for multiple ESC's???
Below is the PWM code I started to play with. I welcome anyone's suggestions/help on this subject. If anyone has questions about the design and the use of the Cricut, please let me know. I'm better at that then I am with coding!
Code: Select all
/*
Arduino Brushless Motor Control
by Dejan, https://howtomechatronics.com
with any modifications
*/
#include <Servo.h>
Servo FrontPS; // create servo object to control the Front Port Side ESC/motor
Servo FrontSS; // create servo object to control the Front Starboard Side ESC/motor
Servo RearPS; // create servo object to control the Rear Port Side ESC/motor
Servo RearSS; // create servo object to control the Rear Starboard Side ESC/motor
Servo UpPS; // create servo object to control the Port Side Up ESC/motor
Servo UpSS; // create servo object to control the Starboard Side Up ESC/motor
int ForRevValue; // value from the analog pin
int SidSidValue; // value from the analog pin
int ForPower; // this indicates joystick in forward direction
int FrontPSPower; // This will be the total for the forward stick PLUS side stick going to port side motor
int FrontSSPower; // This will be the total for the forward stick PLUS side stick going to starboard side motor
int RevPower; // this indicates joystick in reverse direction
int RearPSPower; // This will be the total for the reverse stick PLUS side stick going to port side motor
int RearSSPower; // This will be the total for the reverse stick PLUS side stick going to starboard side motor
int SidPower;
int SSPower; // this indicates joystick in starboard direction
int PSPower; // this indicates joystick in port direction
String (WhichWay); // string to store direction text
String (OtherWay) ; // string to store turning direction text
void setup() {
// Attach the ESC to their respective pins
FrontPS.attach(8,1000,2000); // (pin, min pulse width, max pulse width in microseconds) controls front port side motor
FrontSS.attach(9,1000,2000); // (pin, min pulse width, max pulse width in microseconds) controls front starboard side motor
RearPS.attach(10,1000,2000); // (pin, min pulse width, max pulse width in microseconds) controls rear port side motor
RearSS.attach(11,1000,2000); // (pin, min pulse width, max pulse width in microseconds) controls rear starboard side motor
// Setup Serial Monitor
Serial.begin (9600);
}
void loop() {
// not sure if delays are required. will test to make sure
ForRevValue = analogRead(A0); // reads the value of the forward/reverse joystick position to use in calculations
delay(10);
SidSidValue = analogRead(A3); // reads the value of the forward/reverse joystick position to use in calculations
delay(10);
// test stuff below
ForRevValue = map(ForRevValue, 540, 919, 0, 125); // scale it to use it with the servo library
delay(10);
SidSidValue = map(SidSidValue, 510, 919, 0, 125); // scale it to use it with the servo library
delay(10);
FrontPSPower = ForRevValue + SidSidValue; // applies more power to the port side motor to make the turn
FrontSSPower = ForRevValue - SidSidValue; // applies less power to the starboard side motor to make the turn
FrontPS.write(FrontPSPower); // Send the signal to the ESC
FrontSS.write(FrontSSPower); // Send the signal to the ESC
// Next part sends info to serial monitor
Serial.print("ForRevValue: ");
Serial.println(ForRevValue);
Serial.print("SidSidValue: ");
Serial.println(SidSidValue);
Serial.print("SidPower: ");
Serial.println(SidPower);
Serial.print("FrontPSPower: ");
Serial.println(FrontPSPower);
Serial.print("FrontSSPower: ");
Serial.println(FrontSSPower);
Serial.println();
}