Using SD Cards with Arduino – Record Servo Motor Movements

SD and microSD cards are an ideal way to store large amounts of non-volatile data for your Arduino projects. Today I will show you how to use SD card modules in your Arduino designs. I’ll also build a servo motor position recorder that can record and playback the motion of a servo motor.

Full article with code – https://dbot.ws/sdcard
More tutorials and projects at https://dronebotworkshop.com
Join the newsletter and let me know what videos and articles you want – https://dbot.ws/dbnews

Today I will take a look at SD and microSD card modules. These are a simple way of adding storage to your Arduino projects.

SD cards have been around since the turn of the century and are used in a variety of electronic devices. I’m sure you probably have several of them for your phone, tablet, music player or camera. If you use a Raspberry Pi a microSD card is used to hold your operating system and data, it basically takes the place of a hard drive in this case.

It is very simple to use SD cards with the Arduino. They connect via the SPI bus and the Arduino IDE has a built-in library to work with them.

I’ll show you how to connect a microSD card module to an Arduino Uno and how to use some of the sample code that is included with the library. This includes code to read and write files to the card, as well as a Datalogger that can record the position of three potentiometers.

After we master the sample code we will create a small project.

Our project will have a servo motor and potentiometer along with the microSD card module. You will be able to move the servo using the pot and record its movements on the microSD card. After that, I’ll show you how to play those movements back.

You can use this code “as-is” or expand upon it to use more servos, perhaps to control a robot arm. You could also use it to record DC motors, LEDs or pretty well anything else you can think of.

Here are the contents of today’s video:

SD and microSD Card Module introduction – 2:20
ReadWrite Example – 5:44
Datalogger Example – 11:53
DumpFile Example – 18:56
Servo Recorder – 21:46
Servo Playback – 27:25

As always you will find a detailed article to accompany this video no the DroneBot Workshop website. Check it out at https://dbot.ws/sdcard . The article also has the code for the servo motor recorder and player in a handy ZIP file.

Hopefully this will inspire you to include SD cards in your next Arduino design.

If you’d like to have a say in what videos and articles I create please sign up for the newsletter. No sales, no spam, just information about what is going on in the workshop and surveys to find out what content you would like to see and read. You can join by following this link – https://dbot.ws/dbnews

And if you aren’t a subscriber yet please do subscribe to the YouTube channel. That way you won’t miss out on any of the videos.

source

You might be interested in