Coding for a GA6-B

38 views
Skip to first unread message

flyway38

unread,
Nov 30, 2022, 1:21:39 PM11/30/22
to jallib
Hello all,

Am trying to implement code to send SMS and make a Call (for testing only) using this PIC16F19176 with a GSM module: GA6-B.
Heres the arduino code:

// ---------------------------------------------------------------------------
// Example Support of GOOUUU TECH IOT-GA6-B Gprs Gsm Module

// ---------------------------------------------------------------------------

#include <SoftwareSerial.h>
#define GSM_RX 2 // Arduino pin 2 to URX
#define GSM_TX 3 // Arduino pin 3 to URX

SoftwareSerial sim(GSM_RX, GSM_TX); //
// The GSM

String number = "07905582XXX"; //-> change with your number
void setup() {
Serial.begin(9600); // GPS on 0,1 pin

Serial.println("System Started...");
sim.begin(115200);

delay(1000);

Serial.println("Communicating GSM/GPS.....");
sms(); //send sms
call(); //call to us

}
void loop() {
//do your code
} //loop
//-----------GSM Function ---------------------------------------------------------
void sms()
{

Serial.println ("Sending Message");

sim.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode

delay(1000);

Serial.println ("Set SMS Number");

sim.println("AT+CMGS=\"" + number + "\"\r"); //Mobile phone number to send message

delay(1000);

String SMS = "Sample SMS is sending....."; //sms content

sim.println(SMS);
delay(100);
sim.println((char)26);// ASCII code of CTRL+Z

delay(1000);

}
void call() {
sim.print (F("ATD"));

sim.print (number);

sim.print (F(";\r\n"));

}

And here relevant part of my code (not working):
--
include pps
pps_control_lock(FALSE)
RC6PPS = PPS_TX1  -- TX1 re-assigned to C6  (default)
RX1PPS = PPS_RC7  -- C7 re-assigned to RX1  (default)
pps_control_lock(TRUE)
--
--
--
-- ok, now setup serial
--const serial_hw_baudrate = 999_000
-- (115_200 / 256_000 / 512_000 já testados com sucesso)
--
-- Include and initialize serial hardware library.
const serial_hw_baudrate = 115200
--const serial_hw_baudrate = 9600
alias pin_TX_direction is pin_C6_direction  -- Transmit pin.
alias pin_RX_direction is pin_C7_direction  -- Receive pin.
include serial_hardware
serial_hw_init()
--
-- output library
include print
--
include delay
--
const byte AT1[] = "ATD"
const byte AT2[] = "XXXMyNumberXXX"
const byte AT3[] = ";"
--
forever loop
   --
   led = OFF
   delay_1ms(10_000)
   --
   led = ON
   print_string(serial_hw_data,AT1)
   print_string(serial_hw_data,AT2)
   print_string(serial_hw_data,AT3)
   --print_crlf(serial_hw_data)
   delay_1ms(5_000)
   --
end loop

Testing only with a CALL making. No success so far.
AT commands are sent (received and read in computer)
Any help will be great.
Thank you very much.

Best Regards,
Filipe Santos.

flyway38

unread,
Nov 30, 2022, 6:31:06 PM11/30/22
to jallib
Hi again,

Problem solved.
It was all about RX/TX connections and some other code details...

Cheers,
FS.

vsurducan

unread,
Dec 1, 2022, 1:21:51 AM12/1/22
to jal...@googlegroups.com
I would try first with a standard terminal connected to your GSM module, and a link between two computers.
Perhaps there are some delays you need to comply with. That will solve any connection issues (if any).
I remember the BLE communication on some moisture sensors I manufactured, they had the same problem but finally worked.

--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/142573ae-b364-4ba8-b01c-96a7355af724n%40googlegroups.com.

flyway38

unread,
Dec 2, 2022, 4:32:28 AM12/2/22
to jallib
Hi Vasile, yes, have used hyperterminal to understand what was not working and found out some issues about connections and some other bugs in AT commands to be sent.
Also had success in solving this issue.

Cheers,
FS

vsurducan

unread,
Dec 2, 2022, 6:04:06 AM12/2/22
to jal...@googlegroups.com

flyway38

unread,
Dec 2, 2022, 7:48:05 AM12/2/22
to jallib
Hi Vasile,

Did you used AT commands in that BLE project?
Does your code interpret received messages?
Am struggling with that code...
Thanks

Cheers,
Filipe Santos

vsurducan

unread,
Dec 2, 2022, 11:17:48 AM12/2/22
to jal...@googlegroups.com
Yes, but in BLE the AT command set is restricted to several configuration schemes (set device as central unit/peripheral unit, set MAC address, set tx power, sleep, wake, etc). If you are sending auto sms with different text to al your girlfriends...should be much difficult.

flyway38

unread,
Dec 3, 2022, 4:55:29 AM12/3/22
to jallib
Oh, so, no reading of modem acknowledges...
That doesn't help me indeed...
Thanks anyways.

Greetings,
FS
Reply all
Reply to author
Forward
0 new messages