NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Strain Gauge Project

February 25, 2010
by SkateboardTeam
SkateboardTeam's Avatar

Hey,

I've been spending some time lately working with the weight sensor project. Instead of sending the measurements to a computer to display, I want the microcontroller to convert the weight into pounds and display it on the LCD. Does anyone know if this is possible or how I might do it?

February 25, 2010
by bretm
bretm's Avatar

It looks like the python script on the PC side of things turns the ADC reading into pounds with this formula (converted to C):

float pounds = (average - 132.201) / 1.5465;

It uses the average of 40 readings, where the readings are the difference between the + and - polarity ADC results (from the C code on the microcontroller).

To display on the LCD, just replace the line that sets up the UART stream with an equivalent line of code that sets up the LCD stream, from one of the LCD-based projects, and you can printf_P to the LCD instead of the serial port.

February 25, 2010
by bretm
bretm's Avatar

By the way, I'm assuming the values 132.201 and 1.5465 are specific to the scale they actually bought for their demo project. To get it right for a given scale would require calibration. The 132.201 number would need to be replaced by the reading you get when there's no weight, and the 1.5465 would be the increase in the average reading when you apply 1 pound (or one tenth of the increase after applying 10 pounds, etc.)

February 25, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi there,

bretm is exactly right -- and in fact we have it re-zero evey time it's started. But we keep the slope constant, which was just measured by putting a known mass (me!) on the scale.

Mike

March 09, 2010
by SkateboardTeam
SkateboardTeam's Avatar

Hey guys,

I got the LCD displaying the weights now, thanks a lot! I have another question though.

I plan to write the program so that if a weight is over 125 pounds, it will activate a pneumatic switch. The switch runs on 24vdc, however, it is very small and Im sure it doesnt draw too much power. I have been playing around with the mosfets and learning how they work, and I was wondering if the mosfets included in the NerdKit are enough to control this pneumatic switch?

Thanks!

March 09, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi SkateboardTeam,

If you take a look at the datasheet for the 2n7000 transistor (this is such a common part a quick google search will easily turn up the datasheet) you will see it has maximum Drain to source voltage of 60V so it will be able to handle 24V just fine. Do be careful when dealing with these higher voltages though. 24V isn't enough to really hurt you but it will do more than tickle, and it can easily damage the rest of your electric components.

Make sure you take a look at the motors and microcontrollers video tutorial it goes over how to use a mosfet to drive big loads and things you have to think about when doing so.

Humberto

March 09, 2010
by bretm
bretm's Avatar

The datasheet also says it maxes out at 200mA continuous current, so measure the current that the switch draws if you want to be sure.

March 10, 2010
by SkateboardTeam
SkateboardTeam's Avatar

Hey,

As usual, thanks for being so quick and clear with your responses :) I found a switch in the lab that runs of only 12V, so just to be safe I'm going to use that for now. I'm sure I'll be returning with a new question in a few days or so, but for now, thanks a lot!

Post a Reply

Please log in to post a reply.

Did you know that you can use printf and scanf functions to talk to your computer from your USB NerdKit? Learn more...