Main Site Documentation

Micro-Controller TTL Communication and logging data to a SD Card


#1

I’m nearly brand new to micro controller programming, though I’ve done work with some embedded systems, and a bunch of database and front end development. I heard something about the .net Micro framework on a http://www.dotnetrocks.com episode where they were reviewing previous episodes. That got me on Google and a Scott Hanselman blog entry, and eventually to the Fez Panda, which I think I got the last one at the low entry price.

PWM has always been something I have wanted to play with. I have a pile of LED’s laying around from a previous project so when I received my new Panda I promptly started up a project with LED’s. (I’ve documented that project here: http://www.microframeworkprojects.com/index.php?title=PWM_LED_with_Threads) So then I thought, what next. There has got to be something I can do with this thing that is more useful than lighting leds with PWM.

…I have it. I’ll lay out what I am working with, what I want to do , and see if this sound possible as well as get input on the design.
From 1000 feet, I have a car, and I have a piggy back custom (www.moates.net) microcontroller that sits on the engine control computer providing custom engine control, and complete logging of engine computer data. Currently to log data from this microcontroller, I have to connect a laptop with a USB cable and use some software that sends a request to the microcontroller, which then starts sending back “live” data.

Thus my goal for this new Fez Panda project is to take the place of the PC Software, PC, and USB cable and talk directly to the control microcontroller via TTL or RS-232 to send data requests and then receive data. Then write the received data to an SD card where it can be later reviewed. And as a bonus, I would like to read a couple sensors (1-5vdc, or 4-20ma) and have software that processes those signals and based on some rules drives a relay.

And the eventual goal would be to have this black box, that can log the data, monitor some sensors, and interpret the data logged + sensor data to display information in numerical or graphs on a touch screen!

Before I get to far into the first phase of this. I need to consider some architecture issues in creating software like this. To start with, is there any reason to think that the .net Micro Framework, or the usBiz chip set simply can’t do this?

I can connect to a TTL interface on the micro-controller. It is a 5v, serial TTL interface and must be driven at 921.6baud.

My thought was that I would be setting up multiple threads. One thread handling the TTL work. One thread for the SD card work and then the main thread to rule them all. Do I need to consider lower level access for the TTL work?

Any ideas, opinions welcome.


#2

Mike, this is what .net MF is perfect for.

My only concern would be whether your device will like 3.3v levels on the ttl line, it shouldnt be a problem though.

I don’t think you need separate threads for SD and UART, that could lead to deadlocks and taking up unnecessary memory with queues of stuff. I’d just read from the UART and write to the SD card all in one.

One thing i would suggest when dealing with automotive applications, make sure you have a good, clean power supply with some big capacitors in it, as automotive power tends to be rather dirty. Also, do yourself a favour and put a whopping big Transient voltage suppression diode (TVS Diode) between your 12v input and ground as this will cut down a lot of the stupidly high voltages you can get when starting the car or some accessories (like electric pumps and compressors) turn on/off.


#3

[quote]
One thing i would suggest when dealing with automotive applications, make sure you have a good, clean power supply with some big capacitors in it, as automotive power tends to be rather dirty. Also, do yourself a favour and put a whopping big Transient voltage suppression diode (TVS Diode) between your 12v input and ground as this will cut down a lot of the stupidly high voltages you can get when starting the car or some accessories (like electric pumps and compressors) turn on/off.[/quote]

I am glad I read this post. Kinda what i wanted to know.


#4

Thanks for the look. I need to get used to the idea of how threads can impact each other. As far as the power system. I am doing investigation on various aspects of discrete electronics and automotive electrical systems. I’ll eventually be hooking up to another device (Innovate motorsports MTS serial network) and possibly supporting some 0-5v sensor inputs as well.

I will build a voltage regulator to deal with powering the system to even out the fluctuations that can be seen in automotive apps. And yes something to deal with the transient voltages that can occur when starting.

A ton of work ahead of me. Planning a 12 -18 month development cycle with a couple beta devices with phase 1 functionality available summer 2011.