You can enjoy your skate board by adding some electronic parts.
- Parts Requried
For the part of skateboard, we used 90mm wheel, 34” long board deck and below parts. In order to opertate the board, WIZwiki-W7500 ECO module is used for MCU platform and WizFi250 is for WiFi control. If you click each part name, you can check the detailed specification and purchasing information.
1. Parts Required
- Motor
- Motor Mount
- 44T Drive Wheel Pulley Adapter
- 12S 120A ESC
- TorgqueBoards ESC Programming Card
- 12S UBEC
- On/Off Anti-Spark Power Switch
- WIZwiki-W7500ECO
- WizFi250
2. Skateboard Assembly
If you have the experience in using RC, you can easily asseble above parts. If not, you can refer to below picture.
Assembling Wheel Adaptor
Assembling Wheel & Trucks
3. Hardware Configuration for Motor Control
Servo motor is operated by PWM of MCU. In this board, WIZwiki-W7500ECO is used for MCU platform. You need ESC(for controlling speed of motor) and UBEC(for input 5V to WIZwiki-W7500ECO).
If you refer to this Link, you can get more detail information and download source code for motor test.
4. Hardware Configuration for WiFi Receiver
This device has 3 output pin and 2 input pin. Input pins are for getting voltage from battery and Output pins are for controlling motor.
5. WiFi Receiver Firmware
Firmware of WiFi receiver is operated as below. If smartphone push “Speed Up” button, Wi-Fi receiver will increase motor speed and it push “Speed Down” button, Wi-Fi receiver will decrease motor speed by 5 percentage.
In the abnormal situation such as WiFi disconnection, the Wi-Fi receiver will stop motor. (even if motor stops, the skateboard will keep moving due to its acceleration.
You can download source code for Wi-Fi receiver from the Link
#include "Servo.h" #include "WizFi250Interface.h" #define SECURE WizFi250::SEC_WPA2_MIXED #define SSID "Kaizen_Skate" #define PASS "qwertyuiop" #define SERVER_PORT 5000 #define STOP_MOTOR 50 #if defined(TARGET_WIZwiki_W7500P) WizFi250Interface wizfi250(PC_2,PC_3,PC_13,PC_14,PC_12,NC,115200); Serial pc(USBTX, USBRX); Servo motor_speed(PC_8); // it used to percentage value ( 0 ~ 1 ) DigitalOut green_led(LED2); DigitalOut red_led(LED1); DigitalOut blue_led(LED3); #endif #define START_MSG "START" #define END_MSG "END\n" #define CONTROL_UP "UPXX" #define CONTROL_DOWN "DOWN" #define CONTROL_CRUISER "CRUI" #define CONTROL_STOP "STOP" #define STATUS_CMD_OK "OKXX" #define STATUS_CMD_FAIL "FAIL" #define CONTROL_MSG_SIZE 19 // Control Pkt Format : START,CONTROL,SPEED_VALUE,END // START,UPXX,500,END // Status Pkt Format : START,CONTROL,SPEED_VALUE,STATUS,END struct control_pkt{ char start_msg[6]; char control_msg[5]; char speed_msg[4]; char end_msg[4]; }; void parse(char buffer[], int *j, char *string); int main() { int recv_cnt,j; volatile float speed_value = 0.5; char recv_control_msg[100]; char status_msg[100]; control_pkt control; pc.baud(115200); green_led = 1; red_led = 1; blue_led = 1; wizfi250.init(); wizfi250.setAntMode(WizFi250::PCB); wizfi250.setAddress("192.168.100.2","255.255.255.0","192.168.100.1"); if ( wizfi250.connect(SECURE, SSID, PASS, WizFi250::WM_AP)) { red_led = 0; return -1; } printf("IP Address is %s\r\n", wizfi250.getIPAddress()); green_led = 0; red_led = 0; blue_led = 0; TCPSocketServer server; TCPSocketConnection client; while(true) { if( client.is_connected() == false ) { green_led = 1; red_led = 1; blue_led = 0; client.close(); server.close(); if(speed_value == 0.5) { server.bind(SERVER_PORT); server.listen(); printf("\nWait for new connection...\r\n"); server.accept(client); client.set_blocking(false, 1500); } else if(speed_value <= 0.4) { printf("Speed decrease +\r\n"); speed_value = 0.5; motor_speed = speed_value; } else { printf("Speed decrease -\r\n"); speed_value = 0.5; motor_speed = speed_value; } } else { motor_speed = speed_value; green_led = 0; red_led = 1; blue_led = 1; //recv_cnt = client.receive_all((char*)recv_control_msg, sizeof(control)-1); recv_cnt = client.receive_all((char*)recv_control_msg, sizeof(control)); j=0; parse(recv_control_msg, &j, control.start_msg); parse(recv_control_msg, &j, control.control_msg); parse(recv_control_msg, &j, control.speed_msg); parse(recv_control_msg, &j, control.end_msg); if(recv_cnt > 0) { if( (strncmp(control.start_msg,START_MSG,sizeof(control.start_msg)) != 0) || (strncmp(control.end_msg,END_MSG,sizeof(control.end_msg)) != 0) ) { printf("TEST Error\r\n"); sprintf(status_msg,"%s,%03d,%s,%s\n",START_MSG,int(speed_value*100),STATUS_CMD_FAIL,END_MSG); client.send_all((char*)status_msg,strlen(status_msg)); continue; } if( strncmp(control.control_msg,CONTROL_UP,sizeof(control.control_msg)) == 0 ) { speed_value += 0.05; motor_speed = speed_value; printf("TEST UP %f\r\n",speed_value); } else if( strncmp(control.control_msg,CONTROL_DOWN,sizeof(control.control_msg)) == 0) { speed_value -= 0.05; motor_speed = speed_value; printf("TEST DOWN %f\r\n",speed_value); } else if( strncmp(control.control_msg,CONTROL_CRUISER,sizeof(control.control_msg)) == 0) { printf("TEST CRUISER\r\n"); speed_value = (float)(atoi(control.speed_msg)) / 100; motor_speed = speed_value; } else if( strncmp(control.control_msg,CONTROL_STOP,sizeof(control.control_msg)) == 0) { printf("TEST STOP\r\n"); speed_value = 0.5; motor_speed = speed_value; } else { printf("TEST Error 1-2\r\n"); sprintf(status_msg,"%s,%03d,%s,%s\n",START_MSG,int(speed_value*100),STATUS_CMD_FAIL,END_MSG); client.send_all((char*)status_msg,strlen(status_msg)); continue; } sprintf(status_msg,"%s,%03d,%s,%s\n",START_MSG,int(speed_value*100),STATUS_CMD_OK,END_MSG); client.send_all((char*)status_msg,strlen(status_msg)); } else { sprintf(status_msg,"%s,%03d,%s,%s\n",START_MSG,int(speed_value*100),STATUS_CMD_OK,END_MSG); client.send_all((char*)status_msg,strlen(status_msg)); } } }// while } void parse(char buffer[], int *j, char *string) { //extracts next location string data item from buffer int i=0; for (i=0; i<=strlen(buffer); i++) { //TOTAL SIZE OF RETURNED DATA if ((buffer[*j+i] == ',')||(buffer[*j+i] == '\0' )) { //IF comma or end of string //comma is the string field delimiter string[i]=0; //SETS END OF SRTRING TO 0 *j=*j+i+1; //UPDATES to 1 after comma seperated value break; } else string[i]=buffer[*j+i]; //Keep adding to the string } }
6. Android Application
source code : https://github.com/kaizen8501/WiFi_Skateboard
Domonstration
COMMENTS