Cycling on Google Maps - Arduino 32u4 - Leonardo
Cycling is a very popular sport, also thanks to the successful athlete Peter Sagan. Passionate cyclists traverse our roads and sidewalks. However, as the weather does not always matter, many bicycle fans would welcome cycling from the comfort of home. That's why today I bring a way to achieve this, say, augmented reality in the form of Google Maps. At the beginning we will go through the necessary hardware resources for the project and in the next step we will discuss their functionality.
Hardware components:
- Arduino (32u4 CPU) Leonardo
- Magnetic contact
- 2x buttons, switches, push buttons
- 2x 10kohm resistors
To use the system, the user must turn on Google Maps, select any location in the world, and switch to Street View mode. This guarantees a ready interface for interaction with the bicycle (Arduino). As for the bicycle, any type can be used. Classic, road, mountain, exercise bike. A magnetic contact must be fitted to the pedal and the structure.
The main element of the system is the use of the Arduino Leonardo development board, which contains the ATmega32u4 microprocessor. In addition to controlling the GPIO pins (like the classic Uno), this type of processor can also control the keyboard and mouse, it is a HID device (Human Interface device). Thanks to this, we have completely different possibilities of use not only for our idea. The magnetic contact is used to record the rotation of the pedals by a full turn. A simple counter is implemented programmatically, which is incremented each time the pedals are turned 360 °. An optocoupler can also be used.
When the counter overflows, a condition is executed and an up arrow character is sent to the computer, which moves the user one step forward on the Google map. The buttons are used to rotate the view to the sides, they are active as long as the user holds them. The program implementation uses pullup and pulldown button engagement. No resistors are required for pullup, Arduino's internal pullup resistors are switched on. The functionality of both variants is identical.
Cycling can also be enriched by using a VR headset with a Google map. In addition to Google Maps, Street View also uses several other interesting web applications that can be tried out, these are mainly interesting guessing pages (it is possible to involve the whole family):
- GeoGuessr
- Earth Picker
Discover Google maps, search the world for curiosities, visit the places you've always wanted to go. The Arduino with a 32u4 processor can also be used for other interesting projects in the style: Steering wheel, game pedals with analog support with relatively good resolution, handbrake, control panels for simulators and games. The same processor also includes the Arduino Pro Micro, which is suitable for projects with a smaller number of I / O pins.
More about the project: https://arduino.php5.sk/google-maps-bicyklovanie.php?lang=en
![](https://502b182028.cbaul-cdnwnd.com/ce5a9886c6b13a7464007163ceb028fe/200000044-6b47a6b47c/geoguessr.jpg?ph=502b182028)
Wiring diagram for pullup program (for pulldown inverted for buttons):
![](https://502b182028.cbaul-cdnwnd.com/ce5a9886c6b13a7464007163ceb028fe/200000045-0825608258/geoguessr2.png?ph=502b182028)