Welcome to Raspbot V2 repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
3.Scene description
Scenario Description
Scenario DescriptionExperiment ObjectiveExperiment StepsExperimental ResultsMain Source Code AnalysisOverall Flowchart
Experiment Objective
Understand and master a basic function of a large AI model, interact with a smart car through language dialogue, and enable the smart car to describe the current real-time scene.
Experiment Steps
- Observe the IP address of the OLED screen and log in to the remote desktop via VNC.
- Follow the prerequisite configuration tutorial to complete the Tongyi Qianwen key for the Chinese version and the OpenRouter key for the English version.
- Open a new terminal and run the command:
cd /home/pi/project_demo/09.AI_Big_Model/xxxxxxxxxx#Startup command for the Chinese versionpython3 SceneDescription/sp_AI_Image.pyxxxxxxxxxx#Startup command for the English versionpython3 SceneDescription/sp_AI_Image_en.py- Wake up the car using the wake-up phrase "Hi, Yahboom" (for international users).
- After successfully waking up, the car will respond with a honking sound and wait for about half a second. You can then ask the car a question related to the scene.
- After the robot recognizes your voice, wait a few seconds for relevant information to be displayed on the terminal interface and speaker. You can also terminate the current conversation by using the wake-up word.
- This concludes the conversation. To start a new one, repeat steps 4-6.
Experimental Results
- Waiting for wake-up

- After successful wake-up, the green-boxed message in the image appears. You can then ask your question.

- After a while, the terminal will print out the question and answer.


Main Source Code Analysis
xdef Speak_Vioce(): global response if TTS_IAT_Tongyi: tonyi_tts(response) else: Xinghou_speaktts(response)def main(): while True: if detect_keyword(): cv2.destroyAllWindows() os.system("pkill mplayer") time.sleep(.2) start_recording() if TTS_IAT_Tongyi: content = rec_wav_music_Tongyi() else: content = rec_wav_music() if content != "": print("Q:"+content) take_photo() time.sleep(1) mymytext = tongyi_Image(content) time.sleep(1) print("A:"+mymytext) try: response = mymytext tts_thread = threading.Thread(target=Speak_Vioce) tts_thread.daemon = True tts_thread.start() except: pass if content == 0: break time.sleep(0.1) take_photo: Records a photo on the spot detect_keyword: Wake-up function handler start_recording: Recording function handler tongyi_Image: Visual large model analysis interface
Chinese version-specific options: rec_wav_music_Tongyi: Tongyi Qianwen voice recognition rec_wav_music: iFlytek Spark voice recognition You can choose either voice recognition mode. You can enable or disable it in the API_KEY.py file. When TTS_IAT_Tongyi=True, either Tongyi Qianwen voice recognition or iFlytek Spark voice recognition is enabled. tonyi_tts: Tongyi Qianwen speech synthesis Xinghou_speaktts: iFlytek Xinghuo speech synthesis You can choose between two speech synthesis options. You can enable or disable them in the API_KEY.py file. When TTS_IAT_Tongyi=True, either Tongyi Qianwen speech synthesis or iFlytek Xinghuo speech synthesis is enabled.
English Version Speech recognition and synthesis use the iFlytek Spark API by default. You don't need to specify the iFlytek Spark API in API_KEY.py; simply fill in the openAI_KEY key.
Modifying the recording duration, start threshold, and end threshold
- In the terminal, enter:
xxxxxxxxxxcd /home/pi/project_demo/09.AI_Big_Model/nano audio.py- Find the source code shown below.

- start_threshold: The threshold for starting recording when sound is detected (reduced to 5000 in quiet environments and increased to 150000+ in noisy environments).
- end_threshold: The threshold for stopping recording when sound is detected. A recommended value is 30-50% of start_threshold.
- endlast: The number of times to stop recording. Here, 15 is used. For example, Recording will automatically terminate if 15 consecutive sound values meet the stop threshold.
- max_record_time: Recording duration, set to 5 here. Note: start_threshold > end_threshold. This is a required rule, and its value can be determined based on the environment.
- Directory Structure of the Main Files for this Experiment
xxxxxxxxxx├── sp_AI_Image_en.py #Main Entry Point for the English Version├── sp_AI_Image.py #Main Entry Point for the Chinese Version├── tongyi_api_image.py #Tongyi Qianwen Visual Model (This file is required only for model interface modifications)├── tongyi_speak_iat.py #Tongyi Qianwen Speech Recognition├── tongyi_tts.py #Tongyi Qianwen Speech Synthesis├── xinghou_speak_iat.py #iFlytek Spark Speech Recognition└── xinghou_tts.py #iFlytek Spark Speech SynthesisOverall Flowchart
