DIY SelfieBot
Create your own fully 3D printed practical mobile driven robot!
Robot for beginners, intermediate and high education.
Affordable – 95$ only
Programmable – Arduino based.
Compatible with other – Can be used in a combination with other robots
Easy to operate– Remote control, Follow me (tracking function), demo mode.

Software Description work Selfie Bot Firmware Base 1.1

Table of contents

Quick menu:

Purpose of the program

The software is intended to be loaded into the microcontroller hardware Selfie Bot Hardware Base, built on the base board Arduino Nano, comprising a microcontroller Atmel ATmega168 or ATmega328.

This software makes it possible to connect to the device SelfieBot and control the connected servos.

Description of the program

After starting the device initialization is done: run the setup function commands — Initialization pins, UART configuration interface, setting the servo to the initial position. During initialization, the LED lights technology (Arduino Nano to the boards are usually marked with the letter L), which goes out on successful initialization after 1 second.

After initialization, the loop function starts running in an infinite loop — going survey software interface module _Interf_UART to transfer results to the software modules and _Control_Servo1 _Control_Servo2.

_Interf_UART Software module provides a UART reception for the team. In the received stream for UART is a search and identification of a data packet in accordance with a protocol for information exchange. In the case of command detection occurs issuance of the control byte. Work with internal UART provides a library of Serial.

Since the protocol is fixed, then, to the stability of the failure, the module receives each new byte, which came on the UART, and compares it with the expected, in the case of coincidence of the structure of the package is considered to be the last byte of the command and issued. If the bytes do not expect the reception of reset. In the event of failure of the whole exchange, this ensures the correct reception of the next packet (following the flawed) without re-initialization reception timeout circuitry that determines the end of data reception.

Software modules and Control_Servo1 _Control_Servo2 ensure alignment to the servos using the Servo Library command. Upon receipt of the control byte of the interface module takes place identification byte management and development of signals to permit rotation of the actuator in the desired direction. After a certain time (Time_rotate) stops rotation, if not received any other team identified.

Information exchange protocol

Interaction with external devices takes place via UART at 9600 baud.

The data packet consists of five bytes. The first four bytes represent a prefix and are constant in each package. The fifth byte is a byte command.

The structure of the package

№ Byte12345
Command symbolcom=
Command byte0x630x6F0x360x3D

Table 4. Management Team (fifth byte in the packet)

Command symbolCommand byteCommand
W0x57Rotation of a vertical servo to the up
S0x53Rotation of a vertical servo to the down
A0x41Rotate of a horizontal servo to the left
D0x44Rotate of a horizontal servo to the right
x0x78Stop of any movements
R0x52Return servos to the starting point
 CallbackJoinBuy now