» Topics » DIY ideas »Speedometer for scooter

Speedometer for scooter

I bring to your attention my next under the treenamely, the speedometer for scooter.
The background is as follows: for the pleasure of overcoming physical inactivity, the Rollersurf board was purchased. Since there are only two wheels on the board, riding on it requires a sense of balance, you can “stand” on it only in motion. After making sure that after continuous movement at a distance of about 700 meters, the wheels seemed to get stuck in the sand and the movement was very difficult, I turned to the Internet and specialists. It became clear that due to the excessive softness of the wheel material for my weight, the wheel material is very hot and softened, contact with the road increases and the increased viscosity of the wheel makes it difficult to control and create torque. After replacing the wheels with a harder roll, the boards increased significantly, as did the ease of operation. On the same long track, the familiar braking did not happen, the speed continued to increase, which led to an unpleasant drop.
The idea to measure speed and limit yourself in acceleration came, probably after a fall :) There was a prototype from 2014, where such a device was created, but for a different type of board, where the plane of rotation of the wheel does not move much relative to the board and electronics can be placed on the board itself by connecting it to the sensor on the wheel with a flexible wire.
In my case, both the sensor and the electronics should not be placed on the wheel bracket, since the bracket (castor) itself rotates around its axis in a circular manner relative to the plane of the board.
Roller Surf Appearance


Implementation. The transmission specification was chosen by BlueTooth because of the availability of this technology and its presence in the Samsung SM-V700 smartwatch at hand. BlueTooth module was selected HC-05, the controller Arduino Mini Pro, but subsequently replaced by the AtMega168A bare controller, a 500mAh Li-Pol battery was selected to meet the castor's dimensions and the estimated power consumption. As a rotation sensor, the Hall Sensor SS49E was chosen, in contrast to the prototype, as more operational stable. Accordingly, the sketch was slightly modernized. The passage of a magnet mounted in the wheel hub is analyzed by two points: the first actuation — the magnet enters the sensitivity zone - “platoon” and the second actuation — the magnet exits the sensor sensitivity zone - “descent”.The controller counts these events within a specified period of time - 1 second and sends the received number via the communication channel to the Android device, while simultaneously analyzing the incoming signals. The program for receiving, displaying, managing the module was created based on the prototype in the Android Studio environment. It provides for some improvements related to increasing noise immunity. Like the prototype, it calculates speed and distance. The useful function of turning on / off the "headlight" - an LED directed forward in motion - is also saved, as it seems.
Block without cover

Visible top left: red charge reversal protection LED, charge-work switch, battery; below: the green BT module, the AtMega168A microcontroller with flush-cut terminals is glued on its back with the upper part of the case.
Block cover with magnetic sensor

Assembled with the castor, the module looks like this:
Block on castor

In the photo you can see the power switch, the contacts for connecting the charger, on the other side of the unit on the corner above - LED - "headlight".
The prototype program was supplemented with the ability to issue sound and vibration signals at various events (turning on / off the headlight, an alarm signal when exceeding the specified maximum speed limit).
Testing on the table - in the photo below, not yet tested on the road, waiting for the summer :)
Testing on the table

The Android Studio project has a large volume, I’ll post it somewhere with a link, if there is interest, I bring a sketch with comments.
In the presence of interest, I am ready to share ideas, experiences.
Question \ topic is automatically published in the social. site network - stay tuned for answers there:

Suitable for topic

Related topics

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose
1 a comment
Author
ATMega168A firmware sketch:
/*
* Mega168 !!!
*/
#include "timer-api.h"

int Polarity = -1; // polarity of the pulse of the input signal (in my case, negative
int Treshold = 500; // trigger threshold of the read pulse 1/2 Vcc = 512
int CountTurn = 0; // store the number of revolutions for the accounting period
int LED = 13; // LED connected to PB5 pin
int InputSignal = A5; // input for Hall sensor
int TurnNumber = 0; // accumulated number of revolutions
int DeltaT = 28; // delay from the front to determining the end of the pulse for stability
bool Tick = false; // initial value, no tick yet

void setup ()
{
Serial.begin (9600); // for debugging
timer_init_ISR_2Hz (TIMER_DEFAULT); // get 1-second delay !!!
pinMode (LED, OUTPUT); // signal output to the backlight (headlight)
pinMode (InputSignal, INPUT); // input for Hall sensor
}

void loop () // here we do the processing of signals from the sensor and headlight control
{
if (Tick) // permission to execute the if block at a fixed time interval
// send the number of revolutions
{
Serial.println (String (CountTurn) + ";"); // for debugging
Tick ​​= false; // prepare the trace. time interval
CountTurn = 0; // zero the number of revolutions after transferring to the smartphone
}

else // if the tick has not arrived yet, we accumulate the number of revolutions, turn the headlight on / off
{
// accumulation of revolutions
if (analogRead (InputSignal) {
delay (DeltaT); // don't read anything yet
if (analogRead (InputSignal)> Treshold) // trailing edge has come
{
CountTurn ++; // accumulate the number of revolutions upon arrival of the trailing edge
}
}

// headlight control
if (Serial.available ()> 0) // read the character from BTSerial
{
char command = Serial.read ();
switch (command)
{
case '0': digitalWrite (LED, LOW); break; // turn on the headlight
case '1': digitalWrite (LED, HIGH); break; // Turn off the headlight
}
}
}
}

void timer_handle_interrupts (int timer)
{
Tick ​​= true;
}

We advise you to read:

Hand it for the smartphone ...