Category Archives: Arduino

Balancing robot part 3 – Remote control

I made a new version of the mainboard in the balancing robot, fixing all the problems with the previous one. I also got the prototype of the remote controller working. It is sending the X and Y values of the control stick to the robot. The robot is then adjusting its speed setpoint and turning variable based on those values.

The RC input probably needs some filtering. Now I just use the values directly, and if the user does to fast movements there is a risk that the robot falls over.

I am not satisfied with the remote yet. The biggest problem is the controls sticks I chose to use. They are really bad since only a small part around the center of each axis can be used as shown in the video. This makes it hard to control the robot with precision. I will probably redesign the remote to use a real control stick from an RC controller instead.

I have also planned to make the user interface on the remote for adjusting PID values and other parameters in the robot. This is the main reason why it has a display. More about that in a future video.

I have also installed two ultrasonic rangefinder sensors. They will be used for obstacle avoidance in the future, but I will finish the remote controller first.

Prototyping and testing of the balancing robot

Made some progress on the balancing robot project. In this video, I made the first version of the PCB. It had a few problems but I still got the robot to balance. Some of the problems included:

  • Design error with the voltage divider and filter capacitor for the battery voltage measuring. Capacitor blew up 🙂
  • I forgot to connect the MISO, MOSI and SCK lines for the SPI bus.
  • Problem with the fotprint for the wireless module.
  • And a few more minior things…

Apparently, I need to check everything more carefully. Especially with the schematic, before I start to design the PCB itself. I hade also learned from many previous PCB projects that I have made, including this one, that you always need to create important/special component footprints yourself. Comunity-made footprints always have some errors, or something just decisions that I don’t like/want. Enev official footprints for components can have major problems.

In this video, I also show some of my planning of the remote controller for this robot. It will be a custom remote controller with an LCD and two analog control sticks. The controller should be able to control the robot, maybe in different ways. It will also have some kind of menu system for making adjustments to PID values and other settings.

Robot balancing by itself. The battery is just laying there on top. The robot will of course have a top plate for the battery when it is done.
Detailed shot of the first version of the PCB. Here you can also see the wires I had to solder on the connect the PIS bus for the IMU sensor.

DIY FrSky telemetry multi-sensor

I made my own “multi-sensor” for the FrSky radio system. An Arduino Nano reads a few different sensors and sends all the data to the Smart-Port connector on the RC receiver. This way I can get information such as battery voltage, speed, altitude, GPS position, and temperatures on my RC Radio when I fly my RC planes. This is perfect for planes that don’t have a flight controller onboard.

My design and hardware is based on the FrSky library from Pawelsky: https://www.rcgroups.com/forums/showthread.php?2245978-FrSky-S-Port-telemetry-library-easy-to-use-and-configurable

I actually started experimenting with making my own telemetry sensors a few years ago. Therefore my code is actually quite old. Back then, this was the only library available. I still think it works well, but today there are also other alternatives available.

At first, I just soldered a GPS and a servo connector to an Arduino NANO. But later I made a few PCBs to make them easier to assemble. My first versions had voltage monitoring of the individual cells in the flight battery, but I found that it was annoying having to plug in the balance connector of the battery in the plane.

This is my third iteration of the board. It has a single input for LiPo battery voltage monitoring with a voltage divider and filter capacitor, a BMP280 barometer for altitude and variometer measurements, a connection for a Beitian BN-220 GPS or any other NEMA capable GPS for speed and position data, and two Dallas DS18B20 temperature sensors, one onboard and one attached with cables.

Update 2022-01-07: I fixed an error in the PCB design and made a few small adjustments in the code. The links are now the updated versions.

Link to my schematic and PCB: https://oshwlab.com/Axbri/frsky-telemetry-v3

Download link for my code, schematic and PCB gerber-files:
Axels FrSky tememetry sensor V4.zip

Making LED light systems for RC planes

I have been experimenting with making my own LED light systems for RC planes for a while now. I first made my “RC plane hub” for one of my planes in 2019. It was a combination of a LED light system and gyro stabilization. More about that here: http://axelsdiy.brinkeby.se/?m=201911

Later I wanted a small simple standalone system that could easily be installed in any plane. I first made some experiments by just connecting a couple of transistors and LEDs to an Arduino Nano. After a bit of prototyping I made a custom PCB with a ATmega328 processor and some MOSFETs for controlling the LEDs.

V1.0 of my LED controlled board.

The idea is that this board is connected to the full battery voltage of the RC plane, and the outputs are connected to the LEDs. The LEDs themselves are connected on groups of three in series with a current limiting resistor adjusted to the LED type used and the battery voltage. The ATmega328 processor (same as Arduino Uno and Nano) reads a standard servo signal and controls and flashes the LED outputs in different ways depending on the input. This alows the pilot to control the LED from the RC radio.

I usually fly my RC planes on 4 cell Li-ion batteries. They are just over 16 volts fully charged and 12 volts when discharged. This causes the LEDs to be bright at the beginning of the flight and pretty dim at the end. Therefore I usually connected one of those small switching adjustable DC-DC converter boards between the flight battery and my LED board to convert the input voltage to 12 volts. When also adjusting the current limiting resistors for the LEDs to 12 volts this works quite well.

For the LEDs themself I use cold white surface mount LEDs for landing lights and strobe lights. I have made my own custom PCBs for them, as can be seen in the video above. For the colored navigation lights, I use standard 5 mm LEDs, of the brightest type I can find.

cold white surface mount LEDs for landing lights and strobe lights.

Later I made a new version of my custom LED controller board with a built-in fixed 12V switching regulator. Otherwise, it is the same processor, MOSFETs, and software as the first. I also skipped the indicator LEDs for each channel to save space on the PCB.

The new board is 60 x 25 mm. The 12V regulator can supply up to 3A to the LEDs. The MOSFETs can handle up to 3A each. Whish is a lot more than needed. The input voltage to the board can be up to 40V, or 10 li-ion cells in series. If the input voltage is lower than 12V the LEDs and the board will still work, but the LEDs will no be as bright.

Here is a link to my Arduino code: http://brinkeby.se/downloads/RCplaneLightSystemV2.zip

Feel free to use and modify the code as you like. This code can also be used an any standard Arduino Uno or Nano, not just my custom board

Here is my EasyEDA project with the PCB design: https://easyeda.com/editor#id=|d7bd0d7576e04ff88b89458a67529799|d44eedf4a12541269b71d3d20c136a3d

Lidar Robot

This is a video of my DIY Lidar robot. Here it is using a spinning laser distance sensor (Xiaomi robot vacuum spare part) to drive around and avoid obstacles. The sensor is connected to a Raspberry Pi running a Python script that is the main behavior program. There is no mapping going on, the robot is just going forward and turning away from things that are to close. The Raspberry Pi then sends serial data to an Arduino that controls stepper motors driving the robot.

The Xiaomi laser distance sensor is connected to a Teensy 3.2 running code from this project: https://github.com/getSurreal/XV_Lidar_Controller

The Teensy 3.2 is running PID speed control for the DC motor that spins the sensor. It is also reading the binary sensor data and sends it in easy to understand ASCII-messages over serial to the Raspberry Pi. The sensor spins at 5 revolutions per second and makes a distance measurement for every degree. Resulting in 360*5 = 1800 measurements per second. The accuracy is within a few centimeters. This sensor trigonometry to measure distance, in that way it is not a real Lidar sensor.


Bush Beast 3 electronics

Here is a video of me assembling the main electronics board used in my Bush Beast 3 RC airplane.

A Teensy microcontroller is used to read a decode an S-bus signal from the receiver and make all the servo signals. It manages servo mixing and gyro stabilization, as well as controlling LED lights on the plane.

More info about this, including schematics and code can be found on the Bush Beast 3 page here: Bush Beast 3 page

There you can also find some build-images

DIY motorized roller blind

This video shows my DIY Motorized roller curtain. It is driven by a stepper motor. An Arduino Nano is used to read IR signals from an old TV remote and control the roller curtain.

EasyEDA project with schematic and PCB layout:
https://easyeda.com/Axbri/roller-curtain-controller

Arduino code:
http://brinkeby.se/downloads/MotorizedRollerBlindCodeV1.zip

3D printed STL parts:
http://brinkeby.se/downloads/MotorizedRollerBlindSTLpartsV1.zip

Rebuild of my “original” balancing robot.

This is the first self-balancing robot that I built that actually worked well. More info about it here. My absolute first self-balancing robot was the “Equaipose bot”, link the page about it here.

This video has gained some attention on youtube, and I think that is why I get at least one email every other week from people asking about the code and schematics for this robot. I have not shared the code of any details about this robot since it is very poorly made and coded. The robot uses multiple Arduinos just to keep the balance and drive the motors, later I also added another Arduino to manage the Ultrasonic sensors and some other stuff. There was also a Raspberry Pi that I planned to use for computer vision experiments, I never came around to doing that using this robot.

Now when I know a lot more about self-balancing robots, and Arduino programming and DIY robots in general, I decided to make a new version of this robot. I new complete rebuild of it. My intention is to make the robot less complicated and also better. I stripped down almost everything in the robot and started over. Still using the same old wooden chassis. The new version is based on a single Arduino MEGA R3 controlling everything in the robot. It reads the MPU6050 IMU, makes all the filtering and balancing calculations, and drives the motors using hardware timers for maximum precision. The new code for this robot is heavily based on the code for my “mini balancing robot”, with some improvements, more info about that robot here. I still use the same old stepper motors, model airplane wheels, and “Big Easy Driver” -stepper motor driver boards. The Arduino MEGA also controls and reads four HC-SR04 ultrasonic sensors using Interrupts. Those sensors are used for obstacle avoidance.

The new version of the robot works now. It balances and drives around avoiding obstacles, but I still have a few things to fix with the code. I want to add a pushbutton for control and a buzzer for feedback, I should also add battery measuring and implement a low voltage cut off to prevent damage to the battery.

I hope to release I video of the robot together with the code and schematic in a couple of weeks.

The servo seen in the pictures is not and will not be implemented in the first version of the code, but the intention is that the servo should be used to make it possible for the robot to raise itself up and start balancing on its own. Maybe I will also ad some sort of remote control since it is a frequently requested feature, But that will be in a later version.

 

Indoor navigation robot update

It has been some time since a worked on this robot. This is a video of me building and installing the main PCB on the robot. The video was actually recorded several months ago, but now I recently found the inspiration to continue to work on this project.

The main board has an Arduino Due that controls the two stepper motors that drive the wheels. The PCB also has a lot of other features including servo outputs/inputs, MOSFET outputs, bumper sensor inputs, 6 DOF IMU (gyro and accelerometer), a few buttons and LEDs, and a couple of other things. In the video, I connect an RC receiver the servo inputs on the board and drive the robot abound using remote control.

The future plans for this robot are to implement a serial interface in the Arduino Due, and then connect it the Rasberry Pi. That way the Rasberry Pi will be able the drive the stepper motors and also read data from the IMU and other sensors. Then I can make a python script or something running on the Pi that gives the robot some interesting behaviors.

I also plan a replacing the Time Of Flight LIDAR sensor mounted on the stepper motor seen in the video with a rotating Laser sensor instead. The problem with the Time Of Flight sensor is that it has a very limited range and sampling time. I recently found out about the rotating Laser Distance Sensor (LDS) used on Xiaomi robot vacuum cleaner robots. It is available for cheap as a replacement part the vacuum robots. There is also an open source project to control the spinning of the sensor an read data from it, which should make it relatively easy to connect to the Rasberry Pi in my robot.