Dynamic Speed Controller

Sebi’s been working on a little project on his own – Dynamic Speed Controller – for our EDF (Electric Ducted Fan), actually making it to respond to manual controls.

Materials:
– Slide Potentiometer
– Seeeduino XIAO
– 10 wires
– 2 red LEDs
– 5v USB battery pack

Sebi loaded the Arduino with following code:

#include <Servo.h>

const int analogInPin = 10;
const int digitalOutPin = 1;
const int analogOutPin = 0;

Servo ESC;

int sensorValue = 0;
int outputValue = 0;
int servoValue = 0;

void setup() {
  Serial.begin(9600);
  pinMode(digitalOutPin,OUTPUT);
  ESC.attach(9,1000,2000);
  ESC.write(0);
  delay(1000);
  ESC.write(50);
  delay(1000);
  ESC.write(100);
  delay(1000);
  ESC.write(180);
  delay(1000);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  servoValue = map(sensorValue, 0, 1023, 0, 180);
  
  Serial.println(sensorValue);
  Serial.println(servoValue);
  
  analogWrite(analogOutPin, sensorValue);
  ESC.write(servoValue);
  
  if (sensorValue == 1023) {
    digitalWrite(digitalOutPin, HIGH);
  } else {
    digitalWrite(digitalOutPin, LOW);
  }
  
  delay(15); //waits for servo to get there?
}

We had Roman & Lili for a dinner so Roman bravely gave it a go.

He had a hard time not to fly away!

Stay tuned, Sebi already announced a new stage – the Remote Controlled Dynamic Speed Controller!

Emmett Doc Brown GIFs - Get the best GIF on GIPHY

Leave a Reply