Arduino C Control Android Phone Via RGOO(AI2 App Inventor)
by avic8051 in Circuits > Arduino
277 Views, 0 Favorites, 0 Comments
Arduino C Control Android Phone Via RGOO(AI2 App Inventor)
Voice-activated smart speakers are common functions of the Internet of Things (IOT), Google phones and NEST smart speakers have voice-activated functions, both use the same voice-activated and speech synthesis technology, built-in microphones, speaker functions and cloud query.
When you first start learning Arduino DIY exploration, you don't need to find microphones and voice output related hardware components, you only need to use your mobile phone as a connection, DIY the voice control function of the smart speaker, and design your own voice control function, such as voice-activated song ordering, home appliance control, countdown application, and other query functions, and design your own voice control. The system also provides a set of C program to decode IR signal, which is convenient for design and application.
As long as you understand the Arduino C program, you can easily implement it with the Arduino part in your hand, and there is no need for bilateral DEBUG between C and the mobile phone. So, in this tutorial, we will take you to the beginning of how to set up a minimalArduino voice-activated system. Let's get started!
🤖RGOO is designed by its own voice control, the system SDK is continuously updated, and the Chinese version has been released
In Taiwan, the Talking Cat AI voice control tutorial ---- the ZEC crowdfunding platform, https://bit.ly/4eKveo3
Think about what kind of application you want the system to do, how to become your own exclusive AI voice control partner, so that the voice partner can be voice-controlled and responded by the voice of the mobile phone?
In this article, we will start by making your own basic Arduino minimum voice control system, which can be controlled and started remotely with just the C program. Features:
*The Android phone can be controlled by remoter
*Lower the barrier to entry
*It can be used as a cross-platform C application programming
*The hardware is easy to assemble
---------------------
🤖RGOO (Remote ControlGoogle) is a set of open source tools (programming with AI2 App inventor blocks) users can simply Arduino C . The program controls the actions of the Android phone, such as voice input and voice output. A common problem with old phones is that the battery fails, or the battery swells and affects the appearance of the mechanism. After installing RGOO, just like installing a functional activator, you can design many life applications, and through the resources provided by the system, you can use C programming to realize it, and learn C programming skills while entertainment.
Supplies
Minimum hardware use parts
1 Arduino UNO
https://www.ruten.com.tw/item/show?21522556708957
2 Remote Control Receiver Module (HX1838).
https://www.ruten.com.tw/item/show?21310198500426
3 RC37 Remote Control
https://www.ruten.com.tw/item/show?21310198500426
4 HC06
https://www.ruten.com.tw/item/show?21519332463559
5 passive buzzer
https://www.ruten.com.tw/item/show?21504357937220
6 Dupont Line
4 Steps to Make Your Old Phone Active:
1 Install the RGOO program, you can easily test and experience the basic functions of voice control and voice.
2. Link UNO standard device.
3. Upload to the cloud and prepare the connection settings.
4 Once connected, you can do more applications, including voice-activated appliances.
Actual Connect Drawings
Minimum UNO Hardware Circuitry
This is the minimum system circuit diagram, and the control circuit is divided into the following parts:
*Button: Test function, connect to D9.
*Piezoelectric horn: audible warning, connected to D8.
*Remote control receiver module: receive remote control signal and connect to D10.
*Bluetooth module: Connect to the Arduino breadboard to establish a connection with your phone.
When the power supply is added, the piezoelectric horn will beep to do a simple test function.
Basic Test C
//URG_RC.TXT: UNO Arduino C program text file
#include <SoftwareSerial.h>
SoftwareSerial ur1(2,3); //D2 RX,D3TX
#include <rc95a.h> //IR decoder
//decode value BYTE 3
#define D0 22
#define D1 12
#define D2 24
#define D3 94
#define D4 8
#define D5 28
#define D6 90
#define D7 66
#define D8 82
#define D9 74
-------------------------
int cir=10; //ir pin
int led=13; //LED pin
int bz=8; //buzzer
String ans,echo; //vc answer/echo
bool fans; //flag get vc answer
bool fkey; //flag get rc_key
char key; //key value
char btc; //bluetooth value
//=================================
void setup() {
ur1.begin(9600); Serial.begin(9600);
pinMode(cir, INPUT);
pinMode(led, OUTPUT); pinMode(bz, OUTPUT);
be(); led_bl(); Serial.println("Be to link BT!");
}
//--------------------------------------------
void led_bl()//led blink
{
int i;
for(i=0; i<1; i++)
{
digitalWrite(led, HIGH); delay(50);
digitalWrite(led, LOW); delay(50);
}
}
//-----------------------------------------------------------
void be()//beep
{
int i;
for(i=0; i<100; i++)
{
digitalWrite(bz, HIGH); delay(1);
digitalWrite(bz, LOW); delay(1);
}
delay(100);
}
//-----------------------------------
void loop()//main code
{
int i,c;
while(1){
//scan ir code
no_ir=1; ir_ins(cir);
if(no_ir==1) goto loop;
//found ir signal
led_bl(); rev();
for(i=0; i<4; i++)
{ c=(int)com[i]; Serial.print(c); Serial.print(' '); }
Serial.println(); // delay(100);
fkey=0;
//decode 4 bytes com[0~3],compare byte 3
if(com[2]==D1) {key=1; fkey=1; be(); led_bl(); }
if(com[2]==D2) {key=2; fkey=1; be(); led_bl(); }
if(com[2]==D3) {key=3; fkey=1; be(); led_bl(); }
if(com[2]==D4 ){key=4; fkey=1; be(); led_bl(); }
if(com[2]==D5) {key=5; fkey=1; be(); led_bl(); }
if(com[2]==D6) {key=6; fkey=1; be(); led_bl(); }
if(com[2]==D7) {key=7; fkey=1; be(); led_bl(); }
if(com[2]==D8) {key=8; fkey=1; be(); led_bl(); }
if(com[2]==D9) {key=9; fkey=1; be(); led_bl(); }
if(com[2]==D0) {key=0; fkey=1; be(); led_bl(); }
loop:
if(ur1.available()) //Bluetooth link
{
btc=ur1.read(); //read command
//=========================================
if(btc==1) { //comc1==output voice or data
C1=Say the content C2=Voice-activated reading of the answer echo back
//C1=key word=SAY GVC http
//C2=send answer & echo
if(fans==1) { ur1.print(echo); fans=0; }
//============================
if(fkey==1) { fkey=0;
if(key==1){ur1.print("SAY= k1 "); be(); }
if(key==2){ur1.print("SAY= k2 "); be(); }
if(key==8){ur1.print("GVC vc "); be(); }
}//
if ( Serial.available() > 0) {
c=Serial.read(); led_bl();
if(c=='1') {ur1.print("pc key1"); led_bl(); }
if(c=='2') {ur1.print("pc key2"); led_bl(); }
if(c=='8') {ur1.print("GVC vc… "); led_bl(); }
}//PC key test
}//C1 key========================
if(btc==2){
fans=0; ans=ur1.readString(); // read answer
Serial.print(">"); Serial.println(ans); //show answer
if (ans.indexOf("LED")>=0) {led_bl(); led_bl(); led_bl();
fans=1; echo="SAY= LED BLINK "; }
if (ans.indexOf("My dreams")>=0) { delay(1000); } { delay(1000); }
fans=1; echo="https://www.youtube.com/watch?v=70qyvaQLLZQ"; }
}//C2 com
}//ur1 BT
}// while 1
}//loop
Remote Control Decoder Program
The system needs to be able to detect the remote control signal, and for the appropriate format, solve the four-byte for easy comparison.
So we wrote an infrared decoding program, put it in the download software, decompressed it, put it in the system, and you can easily decode the four-byte data. The usage is as follows:
#include < rc95a.h> - Reference to the IR remote control decoding library
while(1){
loop:
//scan ir code
no_ir=1; ir_ins(cir);
if(no_ir==1) goto loop;
//found ir signal
rev();
for(i=0; i<4; i++) //output 4 byte data
{ c=(int)com[i]; Serial.print(c); Serial.print(' '); }
}
........................
//decode 4 bytes com[0~3],compare byte 3
if(com[2]==D1) {key=1; fkey=1; be(); led_bl(); }
if(com[2]==D2) {key=2; fkey=1; be(); led_bl(); }
if(com[2]==D3) {key=3; fkey=1; be(); led_bl(); }
if(com[2]==D4 ){key=4; fkey=1; be(); led_bl(); }
Functional TEST
*Scan the QR code to install the RGOO program, and you can easily test and experience the basic functions of voice control and voice.
*Link UNO standard device.
*Upload the cloud AI2, modify the Bluetooth settings, change the Bluetooth address, and prepare the connection settings.
*After the Bluetooth connection, you can do more applications, and the current demonstration program is as follows:
When the Bluetooth is connected, when the user says the ---- LED, the LED on the UNO board will flash, and the mobile phone will say that the LED will flash. Click [SAY] for voice test, and for more application references, click [New_fn] to view more RGOO network link information.
*Test the connection and start first, and then add the remote control function. Connection test, open the monitoring window (Serial) to test the UNO/Google interactive experiment, and test the following after connection:
Monitor window button 1, test message.
Monitor window button 8 to start voice control.
*Remote control function: After connection, the test is as follows:
Remote control button 1 to speak the message.
Remote control button 8, start voice control.
Connect Bluetooth
Upload the AIA program to https://appinventor.mit.edu/ for Bluetooth settings, and now when the AI2 App inventor 2 building block program is connected, it appears completely black. Normally, there should be a list of Bluetooth modules that have been scanned and set, so you can modify to use a fixed Bluetooth address connection method to set the connection.
Attachment Resource
After unzipping(https://bit.ly/4gXusGl), it looks like this:
*URG_RC.TXT: UNO Arduino C program text file
*rc95a directory: Put it in the Arduino system libraries, use it for remote control decoding
*rg0.aia: AI2 App inventor blocks
Once you've successfully connected everything, you've made a UNO basic voice-activated development system!
This is the basis of this tutorial, and if you like related projects, you can follow :
https://www.youtube.com/@avic8051