A simple Demo
The Phone Friend is programmed with CircuitPython, an easy scripting language for microcontrollers. After connecting the Pico and the Ag1171, you're ready to plug in a phone and run some code.
Here's a short demo script. If everything is wired up properly, this script will turn on the Pico's on-board LED whenever the handset is lifted off the hook, and off when it's hung up.
#Switch Hook Indicator Light for The Phone Friend
import digitalio
import board
import time
#setup the on-board LED
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
#setup the switch hook indicator as input
SHK = digitalio.DigitalInOut(board.GP21)
SHK.direction = digitalio.Direction.INPUT
#Setup the PD (power down) pin as output
slicEnable = digitalio.DigitalInOut(board.GP18)
slicEnable.direction = digitalio.Direction.OUTPUT
slicEnable.value = True
time.sleep(.05) #give AG1171 50ms to wake up
while True:
led.value = SHK.value #set LED using switch hook
time.sleep(.1)
Result:

The Phone Friend works with any landline telephone, so the demo code above already works with any type of phone, including rotary and cordless:


Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.