matthew Champion
Published © GPL3+

Throttle Control Over WiFi (for E-Bike or Electric Yacht)

Control the throttle from your phone on the fore deck of your boat when picking up a mooring alone. Also e-bike cruise control.

IntermediateWork in progress219
Throttle Control Over WiFi (for E-Bike or Electric Yacht)

Things used in this project

Hardware components

wemos d1 mini pro
×1
Through Hole Resistor, 270 ohm
Through Hole Resistor, 270 ohm
×1
Ceramic Disc Capacitor, 0.1 µF
Ceramic Disc Capacitor, 0.1 µF
×1
bc547 transistor
×1
LED (generic)
LED (generic)
×1

Software apps and online services

internet browser

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
strip board

Story

Read more

Schematics

Throttle

Code

Wifi-pwm.ino

Arduino
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

int led_pin = 16;
int n ;
String a; 
const char *ssid ="bike" ;
const char *password = "12345678";

ESP8266WebServer server(80);

  /* 
  server ip 192.168.4.1 
  */
  void serv() {
      analogWrite(led_pin,n);
      server.send(200, "text/html", "<html><body><h1>SPEED</h1><form action=\"a\" method=\"post\"> <input class=\"slider\" onchange=\"this.form.submit()\" type=\"range\" name=\"speed\" id\"speed\" min=\"0\" max=\"256\" value=\"" +a+ "\"style=\" width: 100%; height: 25%;background: #000000; outline: 20px;\"> </form><span style=\"font-size: 6.0em;\">"+a+"</span></body></html>");
  }
  void serv1() {
      a = server.arg("speed");
      n = a.toInt();
      analogWrite(led_pin,n);
      Serial.print(a);
      server.send(200, "text/html", "<html><body><h1>SPEED</h1><form action=\"a\" method=\"post\"> <input class=\"slider\" onchange=\"this.form.submit()\" type=\"range\" name=\"speed\" id\"speed\" min=\"0\" max=\"256\" value=\"" +a+ "\"style=\" width: 100%; height: 25%;background: #000000; outline: 20px;\"> </form><span style=\"font-size: 6.0em;\">"+a+"</span></body></html>");
  }
void setup() {
  delay(1000);
  Serial.begin(115200);
  pinMode(led_pin, OUTPUT);

  WiFi.softAP(ssid, password);

  IPAddress myIP = WiFi.softAPIP();
  Serial.print("IP=");
  Serial.println(myIP);
  
  server.on("/", serv);
  server.on("/a",serv1);
  server.begin();
}

void loop() {
  server.handleClient();
}

Credits

matthew Champion

matthew Champion

5 projects • 4 followers
Llandovery, Wales

Comments