That looks like a very interesting sensor. I’m going to have to get one to play with. It allows either I2C or reading PWM to get data from it, so it should not be too hard to make it work with your favorite microcontroller.
What is your experience with micros and writing software for them?
My experience working with microcontrollers is copying what others have done (like a monkey), mimicking exactly how they wire it up to the microcontroller (verbatim), using the same voltages, resistors, and other electrical magic (hopefully they’ve posted the Radio Shack and/or Digi-Key part numbers and show pictures and wiring diagrams of what they did), and finally the code they run inside the microcontroller to act on it all. If I think I can replicate it I run out and order everything! Most times I order two of everything because I usually melt things the first time through trying to solder it all together. If by some miracle or act of god I can get all the electrical things to work, code in the microcontroller to compile, download, and install inside the microcontroller, I then pipe the clean results out to the com port with something like this:
serout S_OUT, i9600, [dec duty, 13] 'output to com port
Whew!
That then gets the data into my world dah-dah-dah-dah (the PC). Then I do really cool things with it!
If I can get this sensor to work I’m going to point it at my motor and motor controller (I bought two sensors)
OK, I bought three of these sensors, maybe I’ll point the last one at me just to see what system is ultimately failing in all of this (sweat beading off my forehead).
I’ll then display the data on my PC touch screen/dashboard (mounted between my handlebars) at which point I hope to notice things are heating up and get off the throttle, at the same time I hope to automatically turn on a fan inside a tube:
that fan will then hopefully start to cool down my etek motor so that the attached wiring doesn’t melt (notice third melted phase wire detached on the right):
OK, now I feel like I’m rambling. What was your question again?
Oh yes…
Not much but I know going down this path will absolutely get me what I need, I’m absolutely willing to study, listen, and learn. Microcontrollers in my opinion are the bridge between the electronics world and the PC.
I’m also studying the CAN bus, and now you know the rest of the story…
OK, well, as long as you don’t suffer from programaphobia, you should do well. My best suggestion is snag yourself a good micro combination, such as the BotBoard II and Basic Atom Pro (get the starter kit with programming manual), and go for the gold. The Atom Pro is very easy to work with, and there is a LOT of good work being done here with it, so no lack of support if you have questions and need help with something. Dig into the data sheet for your sensor and learn about I2C and how to read PWM signals so you can get data out of the sensor. Then put it all together and see what you can do with it.
I have two BotBoard II’s with the Basic Atom Pro and I’m confortable with visual basic so that’'s not a problem. I’m still figuring out how to wire the pins. I’m reading the manual with the sensors (it has four pins instead of three)! I’m not comfortable with the electonics part of it. I’ve gotton the Ping to work so I’m hoping this will work the same.
Well, there are only two choices for getting data from that sensor - I2C and reading a PWM signal. If you don’t already have the programming manual for the Basic Atom Pro, you need to get one. ALL the information you need on both I2C and PWM (pulsin reads) is in there. PWM would be the easiest to start out with.
It’s been quite awhile since I dusted off my Atom Pro and did any programming for it, but I am seriously considering putting it to work again. I am also being tempted by the Arc32 board, but so far I am resisting.
wdist var word
main:
low p8
pulsout p8, 5
input p8
pulsin p8, 0, toolong, 65535, wdist
'wdist = wdist / 148 ;convert for inches
serout s_out, i9600, "Distance: ", sdec wdist, 13, 10] ;display result in terminal
goto main
toolong: ; if the program gets here the sensor is not functioning, or wired wrong
serout s_out, i9600, "Timeout, sensor is not working", 13]
goto main
You will find that most data sheets and device manuals can be difficult to read, but you will need to learn how to decipher them when you want to work with new devices. This is a pretty simple device too. Imagine the more involved devices and learning to use them.
They do have a C# sample on the Melexis (manufacturer site).
SMBus/PWM communication implementation on STC-MCU
This is software for a MCU with 8051 architecture for communication with the MLX90614 using the SMBus or PWM interface.
It includes:
Basic SMBus protocol setup;
Reading measurements from the MLX90614 with the SMBus and calculating the temperature;
Adjusting programmable settings (SMBus address, emissivity) of the MLX90614;
Detecting the PWM signal from a MLX90614 and calculating the temperature.