石榴姐

Elder Phone

 
Overview

Elderphone firmware is used to drive old dial telephones to implement basic phone functions. The basic working principle is as follows:

1) Both ends of the phone provide 10V direct current through the DC-DC boost module. After 1/20 voltage division, the line voltage is detected. When the phone is on-hook, the detection voltage is about 500mV, and the line voltage is about 10V at this time. After off-hook, the voltage drops to about 3V, and the detection voltage is 150mV at this time. The detection port is ADC2

2) When the dial is rotated, both sides of the line are periodically short-circuited, and a dialing pulse is generated that is detected by GPIO9. When the number reaches 11 digits, or it is manually ended with half-dial mode, the call is made.

3) When an external phone is connected and the ring tone circuit is turned on, GPIO19 is set to high level to switch the line boost transformer primary to the 25Hz signal generator, and at the same time GPIO18 outputs a 25Hz square wave pulse driver to generate a ringing signal.

Directory components

Assembly diagram assembly

The same model of phone can be purchased on Xianyu. 1.jpg The system consists of two parts: software and hardware. The phone core board can be purchased by searching for Air724 phone core board on Taobao. The purchase link is: https://item.taobao.com/item.htm?spm=a230r. 1.14.16.7842a199WLhFUA&id=624610770134&ns=1&abbucket=10#detail The baseboard part drawings are completely open source, and there are currently no circuit boards for sale. The source files of the drawings and the hardware part baseboard&coreboard are provided in this project 2.jpg

Software part lua

Using Lua programming, the source code is open source, and you are welcome to use it with MIT authorization https://gitee.com/miuser00/elderphone

Fundamental

1 Based on Elderphone hardware, each module completes the specified function.

2 Complete inter-module communication through Luatask message mechanism

3. There is no code-level dependency between each module, and it can run independently without public variables.

4 Modules can collaborate with each other through message communication

Code running logic (state machine)

1) Monitor the networking status. If a successful networking message is received from the bottom layer, the phone status will be [Connected].

2) If you pick up the phone after connecting to the Internet, the phone status changes to [Dial-up Detection]

  1. If a call hangup message is received from the bottom layer, the current status is [Ring] (the call is ringing but the call is not answered), the status is switched to [Hook], otherwise (the current status is off-hook), the voice "Call has ended" is played. .
  2. If an off-hook message is detected, if the current state is [Ring], the status will be changed to [Call]. If the state is [Dial-up Detection] and the network is connected, 450Hz audio will be played. If the network is not connected, the voice "Initializing" will be played.

5) If you receive a call message from the dial pad, turn off the ring and make the call

6) If you receive a hang-up message and the current status is [Call], hang up the phone, change the status to on-hook, and stop playing 450Hz audio.

7) If the incoming call is terminated, the ringing is turned off

8) When the phone state machine changes, print the current state from the serial port

Module message subscription

sys.publish(...) publishes messages

sys.subscribe(id, callback) subscribe to messages

sys.publish("UARTOUT",msg) Publish serial port debugging messages

example

1) Turn on the ringer

require "Alarm"

sys.publish("ALARM_ON)

2) Make a call

require "Call"

sys.publish("CALL",117) Call the number 117

Module message definition:

Alarm

receive messages

"ALARM_ON" Ring the bell

"ALARM_OFF" turns off the ringtone

make an announcement

"AMARM_ON OK" Ringing successfully

"AMARM_OFF OK" Ringtone turned off successfully

"AMARMING" is ringing

"AMARMING STOP" Ringing stops

Serial debugging messages

"Ring" "Stop ringing"

Call module

receive messages

"CALL",s_TEL Call the number s_TEL

"OVER" hang up the phone

"ANSWER" answers the current call

make an announcement

"CALL OK",s_TEL dialed s_TEL successfully

"OVER OK" Hang up successfully

"ANSWER OK" Answer the current call successfully

Serial port debugging information

"Connected"

"phone connected"

"Call disconnected"

"There is an incoming call, the number is"..num

dialdetect module

make an announcement

"PLATE_MOVING" The dial is moving

"PLATE_STOP" dial pad stops

"DIALING", paulseCount dialing pulse count

"DIALOUT", dialNum dial out number

Serial debugging messages

"Dialing:"..dialNum

"turn the dial"

"Dial Stop"

"dial"..paulse

hookdetect module

make an announcement

"OFF_HOOK" off-hook

"ON_HOOK" hang up

Serial debugging messages

"Off-hook"

"hang up"

tone module

receive messages

"PLAY_450Hz" plays 450Hz dial tone

"STOP_450Hz" Stop playing dial tone

make an announcement

"PLAY_450Hz OK" Play 450Hz dial tone successfully

"STOP_450Hz OK" Stop playing dial tone successfully

Serial debugging messages

"Play 450Hz dial tone"

"Stop playing dial tone"

uartcomm module

Receive messages (currently mapped to hardware serial port 1, which can be changed to USB virtual serial port and other hardware serial ports)

"UARTOUT", uartrsv outputs debugging information from the serial port

make an announcement

msg,[arg1],[arg2] publishes any system message and can contain up to two parameters

system module

receive messages

"NET_STATE_REGISTERED" The network is connected

"CALL_INCOMING",incoming call

"OFF_HOOK" off-hook

"ON_HOOK" hang up

"CALL_DISCONNECTED" call hung up

"DIALOUT",num Dial number num

"PLATE_MOVING" dial movement

make an announcement

"PLAY_450Hz" plays dial tone

"ALARM_ON" Ring the bell

"ANSWER" answers the call

"ALARM_OFF" turns off the ring tone

"ANSWER" answers the call

"CALL",num call number

"OVER" button

"STOP_450Hz" Stop playing dial tone

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 10:51:03

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号