{"id":20279076,"url":"https://github.com/t-vk/electric-unicycle-interface","last_synced_at":"2025-04-11T06:18:17.531Z","repository":{"id":107367125,"uuid":"66219396","full_name":"T-vK/Electric-Unicycle-Interface","owner":"T-vK","description":"Arduino library to interface electric unicycles (e.g. read speed and temperature or change unicycle's settings) via Serial or Bluetooth","archived":false,"fork":false,"pushed_at":"2020-09-17T06:27:18.000Z","size":12,"stargazers_count":21,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T06:18:12.339Z","etag":null,"topics":["arduino","arduino-library","bluetooth","electric","gotway","serial-interface","unicycle"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/T-vK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-21T20:32:15.000Z","updated_at":"2025-02-06T13:15:35.000Z","dependencies_parsed_at":"2023-05-04T03:56:05.658Z","dependency_job_id":null,"html_url":"https://github.com/T-vK/Electric-Unicycle-Interface","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FElectric-Unicycle-Interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FElectric-Unicycle-Interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FElectric-Unicycle-Interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FElectric-Unicycle-Interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/T-vK","download_url":"https://codeload.github.com/T-vK/Electric-Unicycle-Interface/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351417,"owners_count":21089279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-library","bluetooth","electric","gotway","serial-interface","unicycle"],"created_at":"2024-11-14T13:28:01.724Z","updated_at":"2025-04-11T06:18:17.522Z","avatar_url":"https://github.com/T-vK.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Electric Unicycle Interface Library\n\nArduino library to interface electric unicycles.  \n\n## Intro\n\nThis library allows you to receive and automatically decode the data that EUCs (=Electric Unicycles) send via their Bluetooth interface.  \nIt has been tested on several older GotWay EUCs.  \nThis library can be used with serial Bluetooth modules that can act in master mode, like the HC-05.  \nIt can also be used to comminicate with the EUCs internal serial interface directly.   \n(The internal serial interface I'm talking about are the tx/rx pins that go from the motherboard of your Unicycle to it's Bluetooth module.)  \n\n## Features\n\n### Receiving / calculating data\n\n - Read Voltage\n - Read Current\n - Read Speed\n - Read Total Mileage\n - Read Milage since last startup\n - Read Temperature\n\n#### Using these values you can calculate: \n\n - Battery status\n - Acceleration\n - If the unicycle is breaking\n - How much power (Watt) it is currently using\n - and much more...\n \n### Sending commands\n\n - Make the unicylce beep\n - Set the unicycle to madden mode\n - Set the unicycle to comfort mode\n - Set the unicycle to soft mode\n - Set horizontal alignment\n - Turn off level 1 alarm\n - Turn off level 2 alarm\n - Turn on speed alarms\n - Enable tilt-back at 6km/h\n - Disable tilt-back at 6km/h\n \n### Video: Electric Unicycle Interface Example: Led Rainbow and Breaklight\n[![Video](https://img.youtube.com/vi/9l_gGwaTyRE/0.jpg)](https://www.youtube.com/watch?v=9l_gGwaTyRE)  \nCode used: [examples/DirectLedWheel/DirectLedWheel.ino](examples/DirectLedWheel/DirectLedWheel.ino)\n\n### Usage \n\n#### via Bluetooth\n\n``` C++\n#include \u003cSoftwareSerial.h\u003e\n#include \u003cEucInterface.h\u003e\n\n//Bluetooth serial with rx on pin 9 and tx on pin 10\nSoftwareSerial BluetoothSerial(9,10);\n\nEuc Euc(BluetoothSerial, BluetoothSerial); // Receive and transmit data via bluetooth\n\nvoid setup() {\n  Serial.begin(9600); // We'll use the normal hardware serial to print out all the received data\n  \n  BluetoothSerial.begin(9600); // Most unicycles communicate @9600 baud over bluetooth\n  Euc.setCallback(eucLoop); // Set a callback function in which we can receive all the data the unicycle sends\n}\n\nvoid loop() {\n  Euc.tick(); // This simply needs to be called regularely\n}\n\nvoid eucLoop(float voltage, float speed, float tempMileage, float current, float temperature, float mileage, bool dataIsNew) {\n  if (dataIsNew) { // new data received\n    Serial.print(\"Voltage: \");       Serial.print(voltage);      Serial.println(\"V\");\n    Serial.print(\"Current: \");       Serial.print(current);      Serial.println(\"A\");\n    Serial.print(\"Speed: \");         Serial.print(speed);        Serial.println(\"km/h\");\n    Serial.print(\"Total mileage: \"); Serial.print(mileage,3);      Serial.println(\"km\");\n    Serial.print(\"Temp mileage: \");  Serial.print(tempMileage,3);  Serial.println(\"km\");\n    Serial.print(\"Temperature: \");   Serial.print(temperature);  Serial.println(\" deg Celsius\");\n    Serial.println(\"\");\n    Serial.println(\"\");\n  }\n}\n```\n\n#### directly wired to the electric unicycle\nNote: SoftwareSerial only works properly with a baud of up to 9600.\nIf you're wired to the serial interface of the unicycle directly, you'll have to operate at a baud of 115200. \nMeaning you'll have to use your Arduino's hardware serial. \n\n``` C++\n#include \u003cEucInterface.h\u003e\n\nEuc Euc(Serial, Serial); // Receive and transmit data via the Arduino's hardware serial\n\nvoid setup() {\n  Serial.begin(115200);\n  Euc.setCallback(eucLoop); // Set a callback function in which we can receive all the data the unicycle sends\n}\n\nvoid loop() {\n  Euc.tick(); // This simply needs to be called regularely\n}\n\nvoid eucLoop(float voltage, float speed, float tempMileage, float current, float temperature, float mileage, bool dataIsNew) {\n  if (dataIsNew) { // new data received\n    // do something with the received data\n  }\n}\n```\n\n### API docs\n``` c++\nEuc(ReceiverSerial, TransmitterSerial); //create new instance of this class\n\nEuc.tick(); // simply has to be called regularly\nEuc.setCallback(callbackFunction); // you have to specify a callback function to which the class can send the data it receives from the unicycle\n//Example callback function:\nvoid callbackFunction(float voltage, float speed, float tempMileage, float current, float temperature, float mileage, bool dataIsNew) {\n  // Do something with the received data\n}\nEuc.beep(); // make the unicycle beep\nEuc.maddenMode(); // set madden mode\nEuc.comfortMode(); // set confort mode\nEuc.softMode(); // set soft mode\nEuc.calibrateAlignment(); // calibrate alignment\nEuc.disableLevel1Alarm(); // disable level 1 alarm\nEuc.disableLevel2Alarm(); // disable level 2 alarm\nEuc.enableAlarms(); // enable alarms\nEuc.enable6kmhTiltback(); // enable  6km/h tiltback\nEuc.disable6kmhTiltback(); // disable 6km/h tiltback\n```\n\n### More info\n\nThe electric unicycles I tested send their data 5 times persecond with a consistent 200 millisecond delay between them.\n\n### Disclaimer\n\nI will not be responsible or liable, directly or indirectly, in any way for any loss or damage of any kind incurred as a result of using this library or parts thereof.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-vk%2Felectric-unicycle-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft-vk%2Felectric-unicycle-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-vk%2Felectric-unicycle-interface/lists"}