Search Forums by tag:
Serial, mbed, compiler, ethernet, USB, I2C, SPI, interrupt, LCD, library, bug, HTTPServer, CAN, adc, AnalogIn, memory, SD Card, InterruptIn, rpc, Power, SDFileSystem, Ticker, canbus, driver, editor, Error, LocalFileSystem, UART, libraries, TCP, GPS, PwmOut, timer, pwm, file, website, accelerometer, C++, reset, SDCard, RTC, interrupts, clock, DigitalIn, TCPSocket, frequency, led, Java, http, buffer, DMA, SD, flash, HTTPClient, pinball, MODSERIAL, problem, printf, filesystem, SerialPC, RFID, beta, LPC1768, rtos, newbie, compile, digitalOut, Servo, UDP, audio, LPC11U24, RPCFunction, EthernetNetIf, NetServices, m3pi, Download, write, socket, multiple, array, sensor, keil, MATLAB, Forum, debug, hardware, Board, I2S, dead, Sleep, xbee, Nokia6610, AnalogOut, tcp/ip, SPI Slave, code, voltage, wait, network, read, suggestion, dac, JTAG, string, pc, keyboard, copy, GPRS, offline, lwip, Speed, DHCP, Data Logging, windows, time, current, MODDMA, mp3, C, gcc, attach, fatfilesystem, USB Host, publish, assembly, stepper motor, WavePlayer, camera, size, VGA, import, documentation, baud, bluetooth, TextLCD, firmware, M0, pullup, Relay, timing, pololu, MIDI, compiler error codes, magjack, client, robot, Communication, stream, HID, breakout, FIFO, prototype, GPIO, sampling, api, binary, filter, ADXL345, program, DSP, help, sram, class, suggestions, email, PING, arduino, rs232, link, wifi, Nokia, browser, control, Host, Eagle, Modbus, ide, linux, port, updates, Cortex-M0, WiFly, DMX, files, scanf, protocol, PPP, FTP, integer, function, latency, serial port, modem, motors, for, monitor, malloc, Digital I/O, Production, FAT, classes, server, webserver, delay, variables, flashing, time-triggered, PCB, c programming, Analog, labview, watchdog, Encoder, post, math, LPCXpresso, MBED website, GSM, storage, nxp, mobileLCD, license, Terminal, int, counter, baseboard, rj45, EEPROM, E289, mac, Timeout, news, connect, pointers, Optocoupler, Robotics, search, USBMIDI, glitch, find, real-time, format, slave, driverlibrary, MODGPS, processing, networking, ID, umts, float, color, BUTTON, Images, wave, bin, const, OSX, supply, peripheral, sensors, RIT, character, bus, ARM, SRF08, heap, output, basic, piezo, pins, keypad, ID12, Pachube, player, DigitalInOut, object, capture, slow, PSP, OS, display, syntax, mbed.lib, EmbeddedArtists, NMEA, paste, project, GUI, UART0, firefox, motor, SQL, RAM, 3D, bugs, Temperature, not, I/O, Bidirectional, rss, resolved, Pin, Assembler, LED1, LIS302, getc, Safari, Vin, wiki, registers, PS2, fopen, BusOut, projects, RS485, pythonJohnnie,
Exactly the same thing I did w/ my system! I wrote a small program to log temp data and a python program to grab it via USB<->Serial and graph it. I convert the value into decimal Fahrenheit degrees between 0 and 255...
http://mbed.org/users/leimgrub/programs/gpdz5a
I don't remember exactly what I did in the program above, but my understanding of the LM34 datasheet is that without a negative voltage bias, it starts can only read between [5, 300] deg F. It should output 10mv / degF. You need to take into account that the A2D reference is 3.3v (regardless of the fact you power the LM34 from the +5 volt rail). I'm not 100% about if 5 degF reads 0 volts or 50mV and I couldn't find that exactly in the datasheet.
read = 0.0 = 0.0v = 5 degF
read = 0.1 = 0.33v = (33 + 5) = 38 degF
Essentially take the read() result times 330 and add 5 deg.
Let me know how that works out... For some reason I recall subtracting 5, but I don't know why... Maybe you can figure it exactly out!
Thanks!
-John
Thank you much, John! I will give that a try while I am in a phone meeting today. It is nice that I can just grab my breadboard and plug it into any computer to test.
Really loving this embed so far. I just wish unit cost was cheaper so I could use it ubiquitously. I will have to research how the actually MCU is used external to the development system.
- Johnnie
The following is the results I got after a bunch of testing at a temperature of 72 degrees fahrenheit as measured by my DMM temp probe touching the LM34.
-Johnnie
// LM34 temperature fahrenheit temperature sensor calibration test
#include "mbed.h"
Serial usbserial(USBTX, USBRX);
AnalogIn LM34(p20); // LM34 temperature sensor output is directly attached to p20 (no resistor)
// positive voltage supplied by VOUT (pin 40 on embed)
float multiplier = 77; // this number got me closest to the reading on my multimeter temp probe
float temp; // calculated temperature
int count; // for computing average reading
float total;
float average;
int main() {
count = 0;
total = 0.0;
while (1) {
// formula is analog reading * multiplier + 5 degrees F
temp = LM34.read() * multiplier + 5;
count++;
total += temp;
average = total / count;
usbserial.printf("Temperature= %6.2f Average= %5.1f \n", temp , average );
wait(2);
}
}
Please log in to post a reply.

I got my first embed yesterday and I am already enjoying its simplicity of programming and great breadboard formfactor. I did a few light shows on the four LEDs and setup a debug terminal through the USB serial connection. All very cool, and easy stuff - a great out-of-the-box experience.
Then I went to my parts bin and found an LM34 temperature sensor and after a brief wiring snafu was able to setup a temperature data logger in no time. (Breadboard, mbed, LM34, three jumpers) I forced the clock settings for my start time, which was also quite easy (after I read the correct time structure settings).
Just to test I scaled the analog input with just a multiplier hack:
AnalogIn LM34(p20);
temp = LM34.read()*300;
I am sure this number is close, but what is the proper way to scale the input for this device? I am running it directly off the 5V USB (VU), with the output to p20.
So far I love this little embed guy! Thanks for including the handy pin reference cards. I am looking forward to playing with my SPI, I2C stuff today. And my SoundGin and SpeakJet chips are waiting for some use. I will certainly be contributing to the community as my knowledge increases. I guess I can still use all my old PIC stuff for remote sensors. :-)
-Johnnie