Ringing a bell is surprisingly complicated
/def ding(self):
# start the clapper moving towards bell 1
GPIO.output(self.bell1GPIO, GPIO.HIGH)
time.sleep(0.016)
# stop the clapper moving
GPIO.output(self.bell1GPIO, GPIO.LOW)
# pull the clapper back from bell 1
GPIO.output(self.bell2GPIO, GPIO.HIGH)
time.sleep(0.01)
# leave the clapper in the middle
GPIO.output(self.bell2GPIO, GPIO.LOW)
# let the bell ring for a while
time.sleep(0.01)
# start the clapper moving towards bell 2
GPIO.output(self.bell2GPIO, GPIO.HIGH)
time.sleep(0.016)
# stop the clapper moving towards bell 2
GPIO.output(self.bell2GPIO, GPIO.LOW)
After a bit of experimentation I’ve managed to make the bell in the old telephone sound realistic. The original bell was just fed with 70 volts AC alternating at 18 cycles a second. The code above triggers the two coils in the bell to allow it to make do with 35 volts. It was quite fun to write. I hope the neighbours don’t mind the way that I seem to be getting a lot of phone calls…….