So I decided to practise some of my recently-acquired Arduino skillz to try and make a self-balancing robot.
The idea of a robot managing to monitor and update itself so fast it can actually balance really intrigues me. I wanted to see whether I could do it (without too much help from the Internet), and how well it would balance. I had some spare MDF lying around, so got to work…
Continue reading “Self-balancing Robot”
I’m currently making a self balancing robot, powered by an Arduino Nano, and decided to use NEMA 17 stepper motors to power it.
The DRV8825 motor drivers are great, but cannot be driven using a PWM signal. Consequently the Arduino code must send a ‘step’ signal to the correct pin many times per second – Easily in the thousands if you require a decent amount of speed, especially if you’re micro-stepping.
Performance is critical…
Continue reading “Arduino Code – Performance”
In most of my Arduino projects I find myself in a situation where two things apply:
void loop() function needs to run very quickly.
- I need to output data to the serial window.
Unfortunately outputting to the serial window can add significant performance problems, so to keep the speed up I choose to only output every n milliseconds.
This requires a timer…
Continue reading “Arduino Code – Timed Events”
My current Arduino project is a self-balancing robot, which requires repeatedly reading angle and acceleration values from an MPU-6050 gyro.
These values can be quite ‘noisy’ – fluctuating considerably when vibration is added into the system – so I found myself in need of some simple code that helps smooth out the values…
Continue reading “Arduino Code – Complementary Filter”
Needing to write output to the Arduino IDE’s ‘Serial Monitor’ is something you might find yourself doing a lot. It’s one of the easiest ways of giving feedback on variables, and is invaluable when it comes to debugging.
To output content you can use code like this:
All good so far. How about if you want to output a variable? That’s slightly more work…
Continue reading “Arduino Code – Logging”
I have been coding for the Arduino for a while now, and over time I have written a small collection of routines that can be reused in different projects.
I will share some of this code in future posts, but I thought it would be useful to show how you can add code to your project without ‘bloating’ the main source file too much. Continue reading “Arduino Code – Header Files”