The vaults are insufferably damp.
Saturday, August 08, 2009
Saturday Is Over
I didn't work on the morse code trainer or the dresser for Sarah. We went to the zoo and saw the baby giraffe. Then I went over to my inlaws and helped set up a new television. Why can't they just put up an external antenna? They need one if they want over-the-air television. Then I loaded the dishwasher, after that I took Cindy out for dinner at Mimi's.
Sunday, July 26, 2009
Friday, July 24, 2009
August Challenge: Three Projects
It's been too long since I actually finished a project, so I'm doing a challenge: Complete three projects by the end of August. The goal is to complete the (final) design, construction, and programming of three projects. They will be all put together and provided with a safe home (installed in a box).
Here are the three I'm going to do:
-Morse Code Trainer
-In-car Thermometer
-Audio Signal Detector
More details will follow. Wish me luck!
Here are the three I'm going to do:
-Morse Code Trainer
-In-car Thermometer
-Audio Signal Detector
More details will follow. Wish me luck!
Thursday, July 09, 2009
Artishop Update
The 'Choose Liberty' shirt is doing well. It is based on a scripture from Second Nephi:
Men are free to choose Liberty and Eternal Life --2 Nephi 2:27.
See for yourself at the Art Shirt Shop.
Men are free to choose Liberty and Eternal Life --2 Nephi 2:27.
See for yourself at the Art Shirt Shop.
Tuesday, June 30, 2009
Watching Events
Suppose you have an event you want to monitor. It happens usually every 24 hours but could take as long as 72 hours, or longer in rare cases. Each time the event happens a log file is updated. Here's what I've come up with, using Powershell, Arduino, and a voltmeter:
#powershell - read time, update meter
$log = dir c:\logs\logfile.txt
$age = ((get-date) - $log.LastWriteTime).TotalHours
$meter = $age / 72.0
$serialPort.write("meter $meter")
Ok, that works, but you get a linear meter reading (0.0 to 1.0). Using a logarithmic scale makes sense here: Most of the time the event happens about daily. With a log scale the first day will take up the first 3/4 of the meter. If the meter gets beyond 75% (red zone?) something might be amiss.
$log = dir c:\logs\logfile.txt
$age = ((get-date) - $log.LastWriteTime).TotalHours
$meter = [math]::log($age) /4.27
$serialPort.write("meter $meter")
How does that distribute the time (from 0.0 to 1.0)? Try this:
1..15 | % {$_ * 6} | % {"$_ $([math]::log($_)/4.27)"}
If you run that (powershell again) you will see that at 24 hours you are using up to 0.74778. After 48 hours you get 0.91, and 72 hours is at 1.0.
For the Arduino you can make it easier by writing "meter $($meter * 256)". Then you can analogWrite the value to one of the PWM pins and connect that to your voltmeter. If the meter in question has a 3V scale you would use a voltage divider to scale the maximum 5V out to 3V full scale.
I currently have the Powershell side of this working, but instead of the Arduino I'm running the serial out through the MixW serial port bridge and back into a Processing applet.
#powershell - read time, update meter
$log = dir c:\logs\logfile.txt
$age = ((get-date) - $log.LastWriteTime).TotalHours
$meter = $age / 72.0
$serialPort.write("meter $meter")
Ok, that works, but you get a linear meter reading (0.0 to 1.0). Using a logarithmic scale makes sense here: Most of the time the event happens about daily. With a log scale the first day will take up the first 3/4 of the meter. If the meter gets beyond 75% (red zone?) something might be amiss.
$log = dir c:\logs\logfile.txt
$age = ((get-date) - $log.LastWriteTime).TotalHours
$meter = [math]::log($age) /4.27
$serialPort.write("meter $meter")
How does that distribute the time (from 0.0 to 1.0)? Try this:
1..15 | % {$_ * 6} | % {"$_ $([math]::log($_)/4.27)"}
If you run that (powershell again) you will see that at 24 hours you are using up to 0.74778. After 48 hours you get 0.91, and 72 hours is at 1.0.
For the Arduino you can make it easier by writing "meter $($meter * 256)". Then you can analogWrite the value to one of the PWM pins and connect that to your voltmeter. If the meter in question has a 3V scale you would use a voltage divider to scale the maximum 5V out to 3V full scale.
I currently have the Powershell side of this working, but instead of the Arduino I'm running the serial out through the MixW serial port bridge and back into a Processing applet.
Subscribe to:
Posts (Atom)