Thingboot's sound column is controlled by HTTP interface, and the integration is really simple. It is basically a matter of "sending a POST request". Below I will go through the entire solution from design to code implementation.
1. Pain points and solutions
In the study room reservation systems of many libraries, although the reservation is completed on the mobile phone, the step of "finding a seat when people arrive on site" is often done with the naked eye. For example, student A may be late for a seat reservation, but he may be late or forget it, leaving the seat empty and preventing others from taking it; or the administrator needs to use a loudspeaker to shout "Please give up your seat, student XX" in a noisy environment.
Our idea to solve this problem is simple:Connect the "reservation event" in the background and the "sound column in the physical world" through the HTTP interface.
trigger point: The user clicks "Reservation" or "Sign-in" on the mini program/APP, and the background status changes.
execution point: The background automatically calls the API provided by Thingboot to tell the sound column "what to say".
2. Overall design
We do not engage in complex IoT protocols. This set of equipment of Thingboot adoptsWiFi+HTTP, which is extremely friendly to programmers doing software development, and is equivalent to operating a remote web interface.
The entire integration architecture is divided into four layers:
User layer (mini program/Web): Students click to make an appointment, and the administrator operates in the background.
Business logic layer (your backend): Process reservation logic and calculate time,and responsible for splicing voice commands。
Interface calling layer (HTTP client): Your server acts as a client, carries the signature, and sends it to the Thingboot Cloud PlatformPOSTask.
Device execution layer (30W sound column): The sound column stays online through WiFi. After receiving the instruction, it uses the built-inTTS (Text to Speech)The chip instantly converts text into loud real-person voice broadcasts.
flowchart TD
User[用户/管理员] -->|预约/签到/催场| System[自习室业务系统]
System -->|1. 触发语音指令
拼接文本| Logic[语音播报决策模块]
Logic -->|2. HTTP API调用
签名认证| Cloud[芯步云平台]
Cloud -->|3. 下发指令| WiFi[WiFi路由器]
WiFi -->|4. 实时播报| Speaker[30W语音音柱]
Speaker -.->|播放: 请xx同学前往A区| User3. Focus: How to integrate in code
The core of Thingboot’s open interface isHTTP API. Whether your backend is Java, Python, Go, or PHP, the principles are universal. Mainly divided into three steps:Authentication->Splicing instructions->Send request。
1. Authentication mechanism
In order to prevent others from disturbing the library by issuing random instructions, signature verification is performed on the interface. The formula is as follows:sign = md5( md5(AppSecret) + ts )
AppSecret: Your developer key is kept on the backend and should not be leaked to the frontend.
ts: Current timestamp (second level), used to prevent replay attacks after the request is intercepted.
2. Core broadcast instructions
This is the core function of the sound column. You just need to send a JSON formatted string where“play:gbk:XX”The representative announces, followed by the text you want to say.
Note:gbk:16The 16 in it represents the volume, which you can dynamically adjust according to the time period (such as 16 during the day and 10 at night).
3. Code practice snippets
The following isPythonFor example. You can put it in the function where the reservation is successful.
4. Practical scenarios suitable for the “library study room”
It's not enough to just "ring", we have to use the characteristics of the interface to makeScenario-basedexperience.
Scenario 1: Reservation successfully confirmed (seating guidance)
Students often leave after making an appointment, or forget where they are. At the moment when his reservation is successful, the system calls the interface and asks the area where he is located (or the sound column of the main service desk) to announce in a low voice:"Classmate [Zhang San], your reservation for [No. 12, Area C] has taken effect. Please sign in before 11:30. I wish you a happy study!"
value: It solves students’ anxiety of “Did I make an appointment?” and also prevents them from sitting in the wrong seat.
The second scenario: Preventing seat occupancy (intelligent urging)
This is the biggest headache for librarians. In line with your sign-in logic, if the user has not scanned the code to sign in (or failed to enter the gate) after 10 minutes of the appointment time, the system will automatically trigger a voice command:"Student [Zhang San], your reservation for [No. 12, Area C] is about to time out. If you do not sign in within 15 minutes, the seat will be released to other students."
value: Physical reminders are more direct than SMS reminders and can effectively release seat-occupying resources.
The third scenario: closing reminder & lost property
15 minutes before closing: Don't just let the security uncle shout, the system automatically calls the interface: "Dear readers, the library will be closed in 15 minutes. Please pack your personal belongings and prepare to leave the site."
lost and found: The administrator enters "I picked up a water cup in area A" in the background, and directly sends a voice message: "Students who have lost their water cups, please go to the service desk to claim them."
Scenario 4: Administrator broadcast (remote shouting)
If your backend requires manual control by the administrator, you can make a simple interface, enter text, and the backend calls the interface. Administrators don’t need to go to every floor to yell. They can “cloud broadcast” while sitting in the office.
5. Deployment and Troubleshooting Tips
Network coverage is key: 30W speaker columns usually support 2.4G WiFi. The 2.4G in the library has a lot of interference. If there are many walls, the signal will be unstable and the voice will freeze. Reserve a strong signal location for the sound column, or set up 5 backup WiFi groups。
About sound volume: 30W is actually quite loud in the library, equivalent to the volume of a small or medium-sized classroom. If it is a large open study room, adjust the volume parameter to 10-12 (full level 16) during the day and to 6-8 at night to avoid scaring nearby students.
About polyphonic characters: Many TTS will pronounce "Zihan" wrongly. Thingboot interface supportMark the pronunciation of polyphonic words. If you encounter a rare word, just mark it in pinyin in the text (for example: "Classmate Tan"), and the broadcast will be much more accurate.。
Private deployment (optional): If the library’s internal network security requirements are high and no access to the external network is allowed, this sound column supportsPrivate deployment. You can set up the message server in the library LAN, so that the data does not go through the external network at all, and the delay can be reduced to less than 20ms.。
6. Summary
This is not essentially a “hardware development” job;"Add API"work.
You only need to enter the reservation system in"Reservation successful", "Sign-in timeout", "System notification"To these three hook functions, add the above paragraphPython/JavaCode, just spell the text and send it to the sound column. The 30W sound column sound is enough to cover the study room, and TTS's text-to-speech technology can turn cold words into humane reminders, greatly improving the intelligent experience of the library.