Wednesday, January 27, 2010

using RogueSD Arduino lib after SMD exercise

Michael discovered that Rogue Robotics has an Arduino library for the uMMC data logger unit that I have. My uMMC is about 4 years old so I wasn't too surprised that it didn't work when I hooked it up and updated to the latest firmware.

I have a uMMC unit that I successfully upgraded to firmware
102.08-b004 so that I could use the Arduino libraries.
The commands to changing and reading the settings work and the version
command works but Z always returns E05. I've tried 3 different cards
that all worked before upgrading from 101.56 and now they all fail to
initialize. I've tried different baud rates (9600 to 115200) but they
all fail. Does this device support 102.08? Is there anything else I
can do to trouble-shoot this? The Arduino library page says that I
can use 101.56 but the code says I have to have 102.01 at minimum -
which is it? Could you point me at 102.07 so I can try that version?

I mailed support the above message and received a quick response. I ended up sending a picture of my unit and they sent me back my picture with an edit showing where I needed to add a resistor. Great help from RR - quite impressed with the company.

I was a bit nervous about the SMD soldering but it was no problem. I shaped the resistor leads so it fit nicely then I put a bit of flux on the 2 pins that I had to solder the resistor to. I decided to use some fine lead-free solder since I had the extra flux on the pins and that worked out okay. Once I soldered the resistor in, I tested the uMMC using the old firmware and then I upgraded the firmware and tested - it worked! :)

Here's the code I used for testing the uMMC with RogueSD and the latest firmware.

#include "NewSoftSerial.h"
#include "RogueSD.h"

#define COM_BAUD_RATE 115200

#define DATA_LOGGER_FILENAME "/uMMCtest.csv"
#define DATA_LOGGER_RX_PIN 3 // ATmega168 pin 5
#define DATA_LOGGER_TX_PIN 4 // ATmega168 pin 6

// using hardware serial interface for cli communications
static HardwareSerial& comSerial = Serial;
// static NewSoftSerial comSerial(DATA_LOGGER_TX_PIN, DATA_LOGGER_RX_PIN);

// the file handle used for logging; will be > 0 if uMMC present
static int dataLoggerFileHandle = -1;

// The firmware assumes the uMMC API for the data logger.
static NewSoftSerial dataLoggerSerial(DATA_LOGGER_TX_PIN, DATA_LOGGER_RX_PIN);
// static HardwareSerial& dataLoggerSerial = Serial;
static RogueSD ummc(dataLoggerSerial);

void setup() {
comSerial.println("uMMC Test Booting...");

comSerial.print("uMMC Version: ");
dataLoggerFileHandle =, OPEN_APPEND);
if((dataLoggerFileHandle <= 0) || (ummc.LastErrorCode != 0)) {
comSerial.print("uMMC Error: ");
comSerial.println(ummc.LastErrorCode, HEX);

void loop() {
if(millis() > 20000) {
if(dataLoggerFileHandle > 0) {
dataLoggerFileHandle = -1;
comSerial.println("Closed Data Logger");
} else {

void writeToDataLogger() {
if(dataLoggerFileHandle <= 0) {

int chamberPressure = millis() >> 8;
int tankPressure = millis() >> 8;

unsigned long dataLoggerStartTime = micros();

ummc.print(millis(), HEX);
ummc.print(chamberPressure, HEX);
ummc.print(tankPressure, HEX);
if((dataLoggerFileHandle <= 0) || (ummc.LastErrorCode != 0)) {
comSerial.print("uMMC Error: ");
comSerial.println(ummc.LastErrorCode, HEX);

comSerial.print("Micros: ");
comSerial.println(micros() - dataLoggerStartTime);

1 comment:

Bas van Dam said...

Thanks very much for posting your example! I had gotten very much stuck in how to properly use the ummc commands.