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_BAUD_RATE 9600
#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.begin(COM_BAUD_RATE);
comSerial.println("uMMC Test Booting...");

dataLoggerSerial.begin(DATA_LOGGER_BAUD_RATE);
comSerial.print("uMMC Version: ");
comSerial.println(ummc.version());
ummc.sync();
dataLoggerFileHandle = ummc.open(DATA_LOGGER_FILENAME, 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) {
ummc.close(dataLoggerFileHandle);
dataLoggerFileHandle = -1;
comSerial.println("Closed Data Logger");
}
} else {
writeToDataLogger();
}
delay(4000);
}

void writeToDataLogger() {
if(dataLoggerFileHandle <= 0) {
return;
}

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

unsigned long dataLoggerStartTime = micros();

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

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

Sunday, January 24, 2010

sewing with Greg

I went over to Greg's tonight to burn our propellant-filled straws in the strand-burner. The first task was to sew fine wires in the propellant so they can be used to determine the burn rate.



The strand burner is collecting 2 different bits of data: the speed that the propellant is burning through the straw and the pressure in the burn chamber. In the picture below, you can see the gigantic pressure transducer sticking off the burn chamber and the wires all connected to the other end. Everything goes into the box on the floor which then goes to the computer via the DATAQ.



Speaking of pressure transducers, Greg got a couple of these spectacular, tiny transducers!



Good stuff.

Saturday, January 09, 2010

Scouts at EcoCycle

Unloading for people.  The training about what and why is really interesting.

Posted via email from mrtidy's posterous

Shelved the PIC

I've heard from Kelly and then from Ken that the Arduino is the way to go for a hobby embedded project. I had been using the PIC for the FTH project but Michael and I discussed the Arduino and decided we really should take the advice. I bought the ATmega168 with Arduino bootloader installed and built the supporting circuit around it and was up and running within a couple hours. The Arduino is as impressive as people made it sound - seriously good stuff.

Michael started looking at the MsTimer2 library to easily hook into the Timer2 so we can get a reliable interrupt for reading the pressure transducers. I put that into the app and did some testing with delays and Serial printing to verify that Timer2 really would interrupt loop, delays, and Serial. It looks good so far.

Here's a clip of code that sets up Timer2 to just print 'Reading Transducer.' and then a Serial call that should happen about the same time as the interrupt. I got lucky in the timing and feel like it proved itself.


void setup() {
Serial.begin(BAUD_RATE);
Serial.println("FTH-Arduino Booting...");
...
// Read the transducers @ 1kHz
MsTimer2::set(1000, readTransducer);
MsTimer2::start();
}

void loop() {
delay(4000);
Serial.println("Boo");
...


void readTransducer() {
Serial.println("Reading Transducer.");
}


Here's the serial output.


FTH-Arduino Booting...
Reading Transducer.
Reading Transducer.
Reading Transducer.
BoReading Transducer.
o
Reading Transducer.


I've still got the PIC code in Bit Bucket and may build something with the PIC in the future but for now I'm loving the Arduino. Here's the current breadboard.

Sunday, January 03, 2010

Motor test

Download now or watch on posterous
VIDEO0007.3gp (1400 KB)

First video of John's motor test.

Posted via email from mrtidy's posterous