Camera TechnologyLights and Display Board CircuitsRobotics Circuit Diagrams

A Robot with an Elephant’s Memory Schematic Circuit Diagram

Memory Requirements for Complex Robotic Applications

While ‘just for fun’ robotic applications can function well with the limited Flash memory available in most microcontrollers, more intricate or serious applications demand significantly larger memory capacities. For instance, a mobile robot might need to store a complete area map in the form of GPS coordinates or collect extensive data from its sensors.

Challenges with High-Capacity Memory Solutions

Addressing this need with special memory cards utilizing high-capacity Flash EEPROM packages encounters several challenges. Firstly, creating the necessary PCBs becomes complicated, especially for amateurs, due to the small pin spacing of these surface-mount devices (SMD). Soldering such ICs accurately presents additional difficulties. Secondly, these memories, primarily designed for the professional market, are often challenging for amateurs to acquire.

Proposing an Innovative Solution

This article presents a novel solution, provided your robot incorporates at least one PIC microcontroller and you’re comfortable programming it in Basic. These constraints, considering the benefits, are relatively minor. This approach allows you to equip your robot with gigabytes of memory for just a fraction of the cost! The chosen memory solution is the SD card (Secure Digital), originally designed for digital cameras and portable music devices.

Advantages of SD Cards

SD cards offer a cost-effective solution (approximately £7 for 1 GB at the time of writing) that is both compact and highly reliable, provided you stay within the maximum write cycle limit, which ranges from hundreds of thousands to millions, depending on the manufacturer’s specifications. Interfacing these SD cards with PIC microcontrollers is relatively straightforward since their operation mode aligns with the SPI-type synchronous serial interface available in these microcontrollers.

A Robot with an Elephant’s Memory Schematic Circuit Diagram

Handling Electrical Levels for SD Cards

One critical consideration when dealing with SD memory cards is the difference in electrical levels. These cards operate on 3.3 V, while most PIC microcontrollers in our robots are powered by 5 V. The provided figure illustrates a circuit suitable for all PIC microcontrollers in the PIC18 family from Microchip.

Challenges with Software Management

Managing these memory cards in software poses a more significant challenge. Unlike standard EEPROM Flash memories with serial access, SD cards possess internal intelligence. They cannot be read or written directly like ordinary serial access EEPROMs. Instead, a specific protocol must be followed as the card only responds to particular commands. Additionally, various internal registers serve specific purposes. The data’s location in the card adheres to a structured principle similar to diskettes and hard disks, utilizing a FAT (File Allocation Table) that outlines where files’ data is stored.

Simplifying Software Management

While it’s possible to handle this complexity by crafting necessary sub-routines in machine language, this process is arduous and prone to errors. Fortunately, for those interested in integrating SD memory cards into their robots, there exists a Basic compiler tailored for PIC microcontrollers. At the time of writing, MikroBasic compiler from Mikroelektronika offers a comprehensive management library specifically designed for SD-type memory cards. This library streamlines the process when SD cards are wired according to the configuration depicted in our figure.

Accessible Management Library

MikroBasic compiler stands out as it not only encompasses standard functions available in all reputable Basic compilers for PIC but also includes a complete management library for SD-type memory cards. This compiler can be accessed on the publisher’s website (, offering a working demo version for users to explore before making a purchase. It’s worth noting that this compiler’s library also extends support to Compact Hash types, although these are not the primary focus of this article.

We’re not going to detail here the sixteen instructions available for manipulating SD cards, especially since you can download the manual for this compiler free of charge from the publisher’s website. Just be aware that using this product makes the management of such cards ever so much easier, to say the very least! So for example, if you have filled a buffer and want to now store it onto the SD card, all you have to do is write: status = MMC _ Write Sector (number, buffer) where:

  • status is a variable containing a numeric code returned by the command indicating the outcome of its execution (0 for successful, 1 for an error sending the command, 2 for an error during the writing proper).
  • the number is the number of the SD memory sector we want to write to (we explained above that the data storage is similar to that on a hard disk, and now you can see this in practice).
  • a buffer is a label marking the start of a buffer able to hold up to 512 bytes, which is the size of the SD card sectors. Reading the information stored on the SD card and transferring it to the robot processor’s RAM is just as simple, and amounts to a single line of code status = MMC _ Read _ Sector (number, buffer) where:
  • status is a variable containing a numeric code indicating the outcome of the execution of the command (0 for success, 1 for failure).
  • the number is the number of the SD memory sector we want to read.

• a buffer is a label marking the start of a buffer whose size must be at least 512 bytes; this buffer is going to receive the data read from the selected sector on the card. As you will note, it would be difficult for things to be much easier, even though in this article, by nature only a summary, we have not said anything about the card’s FAT management instructions. However, the latter is much less frequently used, once the structure of the card is defined, and a detailed, annotated example about these is Oven in the compiler manual. So then, if your robot needs lots of memory, lend it the SD card out of your camera and pay a visit to Mikroelektronika (www.


Related Articles

Leave a Reply

Your email address will not be published.

Back to top button