Arduino script for MPU-6050 auto-calibration

I while back I did some work on a self-balancing robot using and Arduino Uno and the InvenSense MPU-6050 6DOF sensor. Using the sensor is easy, thanks to Jeff Rowberg's  I2Cdev library and sample code.  If you look around line 200 of the MPU6050_DMP6 example arduino sketch that comes with the library you will see the following: // supply your own gyro offsets here, scaled for min sensitivity mpu.setXGyroOffset(220); mpu.setYGyroOffset(76); mpu.setZGyroOffset(-85); mpu.setZAccelOffset(1788); // 1688 factory default for my test chip I did some further reading on the I2CDev forum and found several threads on calibrating the MPU-6050 sensor and…continue reading →

Experimenting with Sound Localization and Arduino

Today I'm going to walk you through my experience trying to localize the source of a sound using Arduino. My goal with this was to add a feature to my robot that would make it more interactive and look more "alive". Beta 1 What you normally see people doing, as an easy approach, is to measure the volume level from two microphones in which the amplified output is connected to the Arduino analog inputs. Whichever input is higher determines the source direction of the sound. On the practical side this proves to be…continue reading →

Bipolar stepper motor control with Arduino and an H-Bridge

It is a well known fact that Stepper motors are awesome! The only downside is that they can be a bit trickier to get going than servos and plain old DC motors. If you are interested in the inner mechanics and theory of stepper motors, check this excellent post on PCB heaven. If you happen to have one of the cheap little 28BYJ-48 steppers with 5 wires  and a little driver board with them, check this tutorial instead. Here, I will focus on how to get a bipolar stepper motor (typically 4 wires) working with Arduino and a H-Bridge IC like the L293D , or the drop in improved replacement - SN754410NE .(more…)

Arduino Joystick Module Example

In one of my rather frequent eBay visits, I came across a nifty little joystick module, much similar to the analog thumb-stick on the PlayStation 2 controllers. The module is very easy to use with an Arduino uno and only costs a few dollars. Several different versions are available from eBay, Adafruit, Sparkfun and other vendors, but they essentially work the same. Overview The module has 5 pins: Vcc, Ground, X, Y, Key. Note that the labels on yours may be slightly different, depending on where you got the module from. The thumbstick is…continue reading →

Free Arduino reference guide

Erik Verberne teaches Information and Communication Technology (ICT) in Netherlands and looked into the Arduino platform in an attempt to enhance his department's curriculum. He diligently documented his research and is now sharing it with the community. The result is an e-book of over 200 pages full of examples and tutorials, from Arduino and ATTiny programming tips, to working with LCD and LED displays, playing sounds, detecting obstacles, wireless communication via IR and Bluetooth and much more. See the official thread in the Arduino forum for the latest update and a copy of…continue reading →

Arduino robot controlled from an Android phone via Bluetooth

Project overview

This is a differential steering robot that can be controlled from an Android phone via Bluetooth. The robot’s "brain" is Arduino Uno compatible board (an “Arduino on a breadboard”). The robot uses a JY-MCU Bluetooth module for communication with the Android phone. A custom Android app, created with the MIT App Inventor 2 essentially acts as a remote control, sending commands to the Arduino that tell the robot to move forward, reverse, stop or rotate.http://www.youtube.com/watch?v=l7f4o7RvLOU(more…)

Connecting Arduino Uno and the JY-MCU Bluetooth module using SoftwareSerial

My previous post covers the basics of setting up a Bluetooth connection between an Arduino Uno and an Android phone using the JY-MCU Bluetooth module. We connected the  JY-MCU Bluetooth module to the Arduino via a serial connection on (digital) pins 0 (rx) and 1 (tx).This uses Arduino’s built in hardware support for serial communication (via something called UART) and requires no additional libraries. The Arduino has a 64 byte serial buffer and can receive and store data in it, while executing other tasks in your program. For some great examples of using serial communication, as well as wealth of other Arduino related info see Nick Gammon’s web-site.There are a couple of downsides of this set-up for Bluetooth connectivity: (more…)

Arduino controlled LCD using a shift register and the SPI library

Now that I got my recycled 40x2 character LCD working with Arduino, the next step is to get it to show something useful.  I decided to add it to my Bluetooth Controlled robot  and display data from its two ultrasonic distance sensors (initially). Gradually  more interesting info like battery voltage and wheel encoder data can also be shown, as I get those components working. The problem is that now I need to find another 6 digital pins to control the LCD itself. Fortunately, there is an alternative: add a 74HC595 shift register and take advantage of the Arduino SPI library. Here is how: (more…)