Programming to sd card

I am trying to automate my rc car for different courses.  I want to use a microcontroller to log data that remembers the movement from my rc receiver and save it to an sd card.  I would then like to come back and have the car run straight from the sdcard.  That way I can have different sd cards for different tracks.  Is it possible to do this.  I have been using an audrino board to practice programming and an sdcard shield for it. Is there any additional hardware I would need for this project and what would be a good starting point.

In theory this should not be

In theory this should not be that hard to do, but I think that you will run in to problems when running the car from the SD card. The reason for this is when the car is running blind every small change that might be in the steering, motor or even battery current will not be compensated for and the car might take a turn a little bit longer or shorter. Then the whole track is off and it will get worse and worse further down the track.
That said it might still be fun to try, so good luck.

 

Yes, very doable

I should say that there are a great number of steps to get to that goal, however…

Ok, first off I would forget about the SD card entirely. To start, you will need to figure out how to get the data you intend to log. You will need to know the direction of the wheels and more importantly, the distance traveled. Encoders are the way to go here. You will need some kinda quad encoder on each of your wheels. From there, you will need to figure out how your data is going to be read. In the past, I did a data “write” everytime the robot changed direction in any way.

Let’s say you start by going forward. Within the code, it is noted that you are going forward, you start moving and your encoders start counting away. When you hit your first turn or adjustment in travel, the first “leg” would be recorded to SD card. You may use 2 bytes for this, say, a letter and number combo. The first move could be F-237 (forward 237 units) and that would be recorded on to SD. Now we start our turn. The encoder count would be cleared, and the turn starts. When we are done turning, we right to the SD card. It could be R37 maybe (right 37 units). And so on, and so on. Obviously, the “playback” would be the same in system in reverse.

Now, the reason I say you should forget about the SD for now is the fact that you are going to have a lot of time/work investment into just getting your encoders working well. I have wheel encoders on most of my robots and I have never gotten them to work right out of the gate. There will be tweaking and adjusting to do.

From there, you get your SD card up and running and start writing data.

I am curious

how do you plan on going about meeting your goal?

I personally have an idea in mind, but, I don’t want to take away from your thoughts. They might be better. :slight_smile:

The parts you have currently, in my mind, would seem to be enough to meet your requirement. I would think a purpose made board would be a better choice though. You really only need; a uC, a few I/O pins, a voltage regulator, and the sd card reader.