Wow I just found this.
That is incredible work. I loved Bio Shock. It looks like it came right out of the game.
Wow I just found this.
That is incredible work. I loved Bio Shock. It looks like it came right out of the game.
Life is tough, it's even tougher when you're stupid. - John Wayne
Thanks BS Mods! Currently, sorting out the meter programming for the Arduino. The blinkm's library is not playing nice with the serial coms. Not so much a teaser as a work in progress. I'll post up details once its working with the other components.
The meter is showing CPU load % as I open and close applications.
A brief aside for details on the meter/Arduino interface. Some folks were asking how to hook up a meter to their computer. It's pretty easy. I got the idea from here:
http://www.diylife.com/2008/02/02/sh...analog-gauges/ and
http://www.uchobby.com/index.php/200...-analog-gauge/
The second link was especially helpful because of the arduino code. Hopefully, between those links and the following, you'll be well on your way if you want to try this:
Meter
The meter in the video is a 1mA meter from allelectronics.com. Hooked directly to the Arduino, it'll peg at full signal unless we add a resistor. I dropped in a 5.6K resistor which is a little too high (a 5K is closer) so the meter doesn't go full scale if you watch the video. So the meter is simply wired to an Arduino PWM pin (pin 11) with the resistor in line and to ground on the Arduino.
Arduino
The meter is attached to an Arduino Duemilanove which provides PWM output on pins 3, 5, 6, 9, 10, and 11.
For an explanation of PWM, take a look at this Arduino link.
LCD Smartie
So we now have a meter hooked up to the Arduino, we're almost there. To talk to your PC, you need LCD Smartie. Install it and set it up as follows:
I'm showing "CPU usage (%)" on the meter by selecting the variable on the left. Add a letter after the variable. I'm using "A". This will act a separator between the numbers as the the program loops.
Double check that the com port is the same in LCD Smartie as your Arduino IDE.
Code
I've added the documentation to each line of code if you have questions. This is the basics of what you need to interface. You can get more creative with multiple meters or multiple readings but more on this later.
Cut and paste the code to your Arduino IDE and upload to your Arduino. Make sure you don't have LCD Smartie running when you upload. After you successfully upload, start LCD Smartie again.Code:int PWM_Out = 11; //We're using pin 11 but you can use any of the PWM pins (3,5,6,9,10,or 11) int rxChar; //variable for storing characters coming from LCD Smartie int controlValue; //variable for accumulating value to be shown on meter int SetPWM(int value); //function that talks to the meter void setup() { Serial.begin(19200); //open up a line to USB/LCD Smartie pinMode(PWM_Out, OUTPUT); //Setup pin 11 for output controlValue=0; //set accumulation to zero to begin } void loop() //start looping { if (Serial.available()) { //check if serial line is open rxChar = Serial.read(); //read each character from LCD Smartie if((rxChar>='A') && (rxChar<='Z')){ //check if the character is a letter SetPWM(controlValue); //if it is, talk to the meter by passing the accumulated value controlValue=0; //reset the accumulated value to zero } if((rxChar>='0') && (rxChar<='9')){ //check if the character is a number if(controlValue>100) { //check if its over 100 controlValue=0; //if it is reset it to zero } controlValue*=10; //if its not, multiply it by 10 - assume if the value is 25, the //first character(rxChar) is 2 but control value is still zero controlValue+=rxChar-'0'; //now controlvalue is 2, the next time through it becomes 20 with //the above step and the second character(rxChar) is 5 and it gets //added to 20 to become 25. } } } int SetPWM(int percent) { //this function talks to the meter on pin 11 int valid=false; //variable to indicate whether call worked; set to false to begin int pwmPin=0; //Set the pin variable to zero pwmPin = PWM_Out; //Re-assign to PWM_Out float pwmValue; //Declare a variable to hold the meter value converted to a percent if (percent>100) { //If its over 100%... percent=100; //...reset to 100% } if(percent<0) { //If its negative... percent=0; //...reset to 0% } pwmValue=percent*(255.0/100.0); //PWM output is from 0 - 255 so this scales up the value //Read this for more info http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM analogWrite(pwmPin,(int)pwmValue); //Writes the value to pin 11 valid = true; //Everything ok return(valid); //Go back to the main loop }
Your meter should be showing CPU activity so open a few programs and watch the needle jump. You can also try other variable from LCD Smartie like memory usage.
That's the basics of how the PC to Arduino to Meter works. Any questions?
More on how I'm doing this next time.
that meter is effin sick! in a good way, not in the you have herpes kind of way.
Centurion 5 Mod <<--- ON HOLD FOR THE WINTEROriginally Posted by Omega
“Do not trust people like me. I will take you to museums, and parks, and monuments, and kiss you in every beautiful place, so that you can never go back to them without tasting me like blood in your mouth. I will destroy you in the most beautiful way possible, and when I leave you will finally understand why storms are named after people.”
Definitely just tuned out an entire lecture on Database Applications getting caught up on this phenomenal worklog. The techniques and custom work you've been displaying blows me away! Keep up the great work!
TheMainMan
Thanks billygoat. Let me know if my worklogs ever trend in the other direction...please.
Whippersnappers
Thanks TheMainMan! Hope you don't need that part of DB applications
Bit of lesson learned last night. The acid etching primer didn't etch. More likely than not I didn't get all the polish off it. I was putting it together and the paint peeled off like tape. The folks over at the model train forums suggested that baking is the key to get good adhesion and recommended scalecoat paints. Waiting on paint to button up the meter.
A few pictures to tide you over until the painting is complete.
I figured the meter would be seen from slightly above most times so its canted up. You can see how cleanly the paint peeled off.
The etched plate on the back.
The back polished, waiting for more paint.
Rounded the mounting nut to make it lower profile and gave it a quick polish.
The heat from the soldering cracked the original glass so I cut a new piece, ground it to size, and drilled a new hole for the meter adjustment screw. The edges are a little rough but they should be hidden behind the edge of the meter case.
Thanks for looking and many thanks to my sponsors!
Bitspower
Galaxy
HardwareLabs
personally i like it all polished up with the etching semi rough like it is. just my 2 cents
"it only takes one voice to start a revolution"