Ok, it's been done before, but why let that stop me?
Through the holidays, when you visit my blog, here, you'll add to the household festivities because a little bell in my office will jingle. And also, an angel will get its wings.
This version is a PC and Propeller-based holiday kludge-o-rama. Here's how...
Hardware
The 'bell tower' is made of some craft dowels and maple blocks. Since it's basically useless for anything more strenuous, the crap servo out of my ElectrixRC rings a little bell, one of the decorations left over from our wedding several years ago. Don't worry we have about 100 left. Want one?
I'm using one of my miniProp boards for Propeller power. The mass of wires on the breadboard has nothing to do with this project. I was experimenting with a very promising 20MSPS ADC and didn't have any free breadboards to play with. I guess now you know what to get me for Christmas...
The little red mini board houses a 1.5A 7805 regulator to step down from the ~9V from the protoboard power supply I threw together a long time ago. It features a ridiculously heavy transformer. Note the lethal, exposed AC lines. Please--don't do this at home. Seriously. I'm putting this POS in an enclosure the first chance I get.
Software
The bell rings when the propeller receives an "r" character over serial. It gets this message from a BAT file. The BAT file is called from a PHP script. The PHP script is run out of a lightweight PHP web server. The URL for this PHP script is referenced in an iframe on every page of my blog.
Here's the Propeller code (text and pretty versions):
{
WebRinger -- Rings a bell when it receives a signal from the PC which detects visitors to a website
Dependencies..: Servo32v5
Author........: Michael Shimniok www.bot-thoughts.com
}
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000 '80 MHz
ms = 80000
delay = 100
bell = 9
bellMiddle = 1100
bellRight = 1000
OBJ
servo : "Servo32v5" ' Servo controller
pc : "Simple_Serial"
PUB Start | pos, c
pc.init(25,26,9600)
servo.start
servo.ramp
repeat
c := pc.rx
if (c == "r" or c == "R")
pc.str(string("ring!",13))
ring
waitcnt(cnt+500*ms)
PUB ring
repeat 4
servo.set(bell, bellRight)
waitcnt(cnt + delay*ms)
servo.set(bell, bellMiddle)
waitcnt(cnt + delay*ms)
This is the BAT file. I have a Pololu AVR programmer sitting on COM9 talking to the Propeller
@echo off
mode COM9:9600,N,8,1
echo r >COM9
On my website, I include an iframe that sources my locally hosted php script.
And that's it. Perhaps in a later revision I'll set up a web server on an mbed so the whole thing is self-contained.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.