Help me build an RS-232C logger

NeoPTLD

Platinum Member
Nov 23, 2001
2,544
2
81
Hi,

I need a stand alone RS-232C logger, so I don't have to have it connected to a PC to log data with my electrical multimeter.

The meter can support a query every one second and I need a device that can be programmed to inquire the meter via RS-232C command "QM" with a variable interval adjustable from 1 sec to 1 hour, then log the result in .csv format that can be downloaded by connecting the PC to the same serial port. It also needs to have a reasonably accurate time-base for making an accurate inquiry interval.

Thanks

 

bobsmith1492

Diamond Member
Feb 21, 2004
3,875
3
81
You're gonna need a microcontroller and an A/D converter; fairly simple from there on out. A crystal on the micro would provide a very stable and accurate timebase. You can get whatever accuracy you want by getting a better A/D and reference; if you don't need too much accuracy on the readings, you could just use a microcontroller with a built-in A/D. Unfortunately, most of them only have 8 to 12 bit A/Ds, so you'd be better off with an external one. You'd also need somewhere to store your data; that'd be the tricky part. You could get some serial EEPROM, probably, or flash, if you don't need to erase and resave data every few milliseconds or whatnot. If the device will stay on, you can just use RAM for that - but, if the power goes out, you'd lose your data (just a thought).
 

SamurAchzar

Platinum Member
Feb 15, 2006
2,422
3
76
Use one of the AVR microcontrollers from Atmel, Mega32 for example.
It has an internal crystal and some internal EEPROM, so external component count would be kept at a minimum. You would have to use some kind of RS232 level driver (as RS232 is driven at 12 volts), Maxim 3221 IIRC is quite popular.

That microcontroller also has an internal 10bit A/D converter.
You could use any other A/D and just hook it to the SPI bus of the microcontroller.

Post any specific question, i'll try to help.
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
Yeah. You're gonna want a microcontroller.

Lots of ones to choose from - Microchip PIC, Atmel Mega would both do the job admirably. The PICs probably have cheaper development kits and are probably a bit more popular for that reason - but both have a pretty low barrier to entry.

All you need to do is hook up a voltage converter to the microcontroller's serial port (Max233 is a simple choice), to convert from low voltage to RS232 voltage.

Then it's just a matter of hooking up some storage - probably easiest with an SPI serial EEPROM, flash or FRAM. EEPROM is available up to about 32 kB - Flash can come in bigger sizes (I've seen them up to about 512 kB). Or, if you're a little more adventurous, you could go for an MMC (or SD) card - they hook up to the SPI port, just like serial flash, but with a slightly more complex command set.

You'll need a crystal to provide the MCU main clock anyway - integrated oscillators may not be stable enough for reliable serial communications. The MCUs have easily programmable timers that are driven by the main clock, so that's no problem.

Then comes the challenge of writing some software that will work :)

Probably the easiest thing to do is have two modes (set by a switch on the unit). One mode queries the meter every second (or whatever), and the other mode allows the PC to read data off the memory (and or program the timer).
 

SamurAchzar

Platinum Member
Feb 15, 2006
2,422
3
76
There are some serial Flash chips running up to several megabytes in size, even 32MB (I'm familiar with one made by Atmel).

The new crop of internal oscillators can do a pretty good job, in case of the Mega MCUs they give you most popular UART baudrates at around 0.2% error (which is tolerable).
If your application needs strict timing for sampling or whatever, or works at extreme tempratures/voltages, then yea, go with an external.
 

Lord Banshee

Golden Member
Sep 8, 2004
1,495
0
0
just to comment,

I am in MicroP class right now, and we are using a 68HC12 microcontroller.

Someone day asked of a good way to add more A/D input lines, my Professor stated this;
Just use an Analog Mux, which has digital select lines, then you can add as many A/D inputs lines as you need.
This will work as most (well the 68HC12) only has 1 real A/D converter so it can only do one signal at a time anyway so having 100 inputs will not matter as the micro controller will only do one at a time.
This is to respond from the above which stated to get a A/D converter and a Microcontroller. Also some microcontrollers have built in flash.

Feel free to kill all my ideas as i am just a student :)


 

bobsmith1492

Diamond Member
Feb 21, 2004
3,875
3
81
You don't happen to be at GVSU do you? (Lord Banshee) :p We used those here for a while but...

The 68HC11 is an ancient chip; new chips have more features, run faster, and are cheaper.

The analog mux idea still holds although it's only necessary if you want to be reading a ton of different lines...

Another note: do you have a meter that has an RS232 interface on it? It sounded like you maybe did, but I couldn't really tell from your post. In that case all you'd need would be a tiny, cheap uC, RS232 level converter chip, and some storage (and some code).
 

Lord Banshee

Golden Member
Sep 8, 2004
1,495
0
0
nope i am at UF (University of Florida).

They used to use the 68HC11 here but in the late 90's they updated to the HC12, but if it was up to my professor would would use a cheaper and better mc from atmel. But i am sure the HC12 will be used here for at least another 3 years. Freescale doesn't want us to use it anymore though, they have a new chip coming out.

But our teacher try to teach not only the 68hc12, but how it would be done in any cpu. He tries not to use many things are too single CPU oriented. He always makes fun of how many different instructions the HC12 has it is stupied lol.
 

SamurAchzar

Platinum Member
Feb 15, 2006
2,422
3
76
Most any modern microcontroller has a multiplexer in front of the actual A/D, just choose something relatively new and you're all set.