At Icam we are implementing a new way of becoming an engineer. It’s a distributed program focused on a problem based learning pedagogy. The students work every year on a project and study it part after part.
We are currently running the first year and we are planning for the second and third one. The project for these years is going to be an autonomous boat. I’ll make my own version of the boat as a prototype, the students and staff can work with.
With this in mind I want to make as many parts as possible using the machines, tools and softwares available in the fablab. I want the boat to be an experimental equipement so it must be modular for the electronic part and the propulsion system as well.
During the project management week I have detailed some project management tools I use for mechanical design. Here is SysmL diagram, the use case diagram:
For this project, I’ve decided to make my version of a boatduino and in the spirit of spiral development, I’ve done few different versions, to step by step add features to my board .
During the input device week I’ve made my boatduino V0.1 with the following features :
Atmel328p microcontroller
FTDI connector
I2C connector
Digital output indicator
Paths
Board
During the output device week I’ve made my boatduino V0.2 with the following features added to the board :
Double H bridge to connect two motors
External power supply connector
Paths
Board
During the project development week I’ve made my boatduino V0.3 with the following features added to the board :
Removed the H-bridge
Add two mosfests to start the two motors
The idea with this board is to switch on and off the motors seperatly. With the mosfets I can run a higher current to my motors compared to the H bridge.
Paths
Board
I have issues with this version of the boatduino, I couldn’t switch high current properly as it created issues with the command part. As per Neil’s advice, I made a PCB simply for the power supply to seperate it from the command.
Paths
Board
I can plug this PCB to my boatduino V0.1 if I want to supply higher current :
I made all my codes using the arduino IDE. The steps of the code are always the same :
Sense something from the environment :
The yaw angle (thanks to the MPU6050)
A magnetic direction (thanks to the compass)
A GPS position (thanks to the GPS module)
Measure how the boat is moving according to the target
Adjust the speed of the motors to adjust the direction of the boat
To adjust the speed of the boat I’ve made two codes :
One for switching on and off the motors :
//Initialize Motors
const int controlMotor1 = XX; // put the pin number connected to the mosfet
const int controlMotor2 = XX; // put the pin number connected to the mosfet
void setup()
{
pinMode(controlMotor1, OUTPUT);
pinMode(controlMotor2, OUTPUT);
// pull the enable pin LOW to start
digitalWrite(controlMotor1, LOW);
digitalWrite(controlMotor2, LOW);
}
void loop()
{
if (whateveryousense >= -30 && whateveryousense < 30) { // here change the values depending on what you sense
// Turn on both motors
digitalWrite(controlMotor1, HIGH);
digitalWrite(controlMotor2, HIGH);
}
else if (yaw < -30) {
// Turn on motor1 and off motor 2
digitalWrite(controlMotor1, HIGH);
digitalWrite(controlMotor2, LOW);
}
else if (yaw > 30) {
// Turn on motor2 and off motor1
digitalWrite(controlMotor1, LOW);
digitalWrite(controlMotor2, HIGH);
}
delay(10);
}
One for adjusting the speeds of the motors (for smoother navigation) :
//Initialize Motor 1
const int controlPin1 = XX; // put the pin number connected to the H-bridge
const int controlPin2 = XX; // put the pin number connected the H-bridge
const int enablePin = XX; // put the pin number connected to the H-bridge
int motorEnabled = 0; // Turns the motor on/off
int motorSpeed = 0; // speed of the motor
//Initialize Motor 2
const int controlPin3 = XX; // put the pin number connected to pin 7 on the H-bridge
const int controlPin4 = XX; // put the pin number connected to pin 2 on the H-bridge
const int enablePin2 = XX; // put the pin number connected to pin 1 on the H-bridge
int motor2Enabled = 0; // Turns the motor on/off
int motor2Speed = 0; // speed of the motor
void setup()
{
// initialize the inputs and outputs
pinMode(controlPin1, OUTPUT);
pinMode(controlPin2, OUTPUT);
pinMode(controlPin3, OUTPUT);
pinMode(controlPin4, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(enablePin2, OUTPUT);
pinMode(8, OUTPUT);
// pull the enable pin LOW to start
digitalWrite(enablePin, LOW);
digitalWrite(enablePin2, LOW);
// SET A REFERENCE VALUE FOR WHATEVER YOU SENSE
}
void loop()
{
// Map the value of the sensor with the speed of the motors
motorSpeed = map(whateverYouSense, -90, 90, 0, 255); // Here instead of whatever you sense you must put the variable with the value you sense
motor2Speed = - (motorSpeed -255);
// Turn on motor1
digitalWrite(controlPin1, HIGH);
digitalWrite(controlPin2, LOW);
// Turn on motor2
digitalWrite(controlPin3, HIGH);
digitalWrite(controlPin4, LOW);
// PWM the enable pin to vary the speed of both motors
analogWrite(enablePin, motorSpeed);
analogWrite(enablePin2, motor2Speed);
delay(10);
}
These two codes are to be integrated to sample codes given along with the libraries of the different breakout sensor boards we want to use.
During the networking and communication week I found a way to create PCBs to read sensor values and send those values to a master boatduino board using the I2C protocol.
Here it means that I can send values from hundreds sensors to my main boatduino board.
I would like to thanks the people who helped, guided or supported me during these six months. First of all Neil for obvious reasons. Then Romain, Jonah (for taking care of my safety) and Camille for the great guidance and discutions. My friends, colleagues and family for the support and Icam management for sponsoring me and letting me experiment in this wonderful fablab community.