Adding/connecting hardware

Iā€™ve been through the tutorials, but they seem pretty maker/gamebuino specific. Iā€™m not smart enough to translate them to the ringo. Does anyone know if thereā€™s like a quick reference for how we would go about connecting new hardware to our phones?

Also, the tutorials for the circuitblocks stuff arenā€™t exactly for the ringo either. If there was something explaining how to access each piece of hardware, that would be amazing. Iā€™m new to all this stuff, so anything helps.

One of my goals is to play music over wifi/bluetooth/radio. The other is to make a small app that shows you your gps coordinates on the display.

Thanks everyone!

Hey there!

Thanks for supporting this project!

Please be patient, since weā€™re launching a new tutorial platform this week that will feature much more specific tutorials for Ringo and will teach you how to use every piece of hardware Ringo has. :slight_smile:

Now to your app ideas - how do you mean playing music over wifi/bluetooth/radio? What would you connect your Ringo to?

You have to understand that ESP32 that runs Ringo isnā€™t exactly a very powerful chip and cannot do something a phone or a small device can, but itā€™s rather capable to do some simpler tasks.

Also - GPS coordinates idea is unlikely to live, firstly because Ringo doesnā€™t have a GPS module and therefore cannot track your location. :confused:

Keep in touch,
Robert

1 Like

Welp, ok. At least thatā€™s good to know that there will be new learning material soon. Thanks!

If you go to this link, it says the 4g module has gps support, does that require a different module be added then?

https://www.waveshare.com/SIM7600E-H-4G-HAT.htm

Yes, the SIM7600 should easily supply GPS coordinates over its serial port if asked. I believe the relevant AT commands are
AT+CGPS=1,1
AT+CGPSINFO
AT+CGPS=0
but you should look up the command set for the SIM7600 to get all the details.

The string that is read back over the serial port just needs to be parsed for lat and lon (plus date, time, and whatever other info is provided).

I found a sample fragment of code on the internet, and while itā€™s not directly applicable to the Ringo/Makerphone, I think it gives you a general clue to what needs to be done. For example, the SIM7600 is accessed via serial port named Serial1 in the Ringo firmware, while this example fragment uses SIM7600Serial, but you get the general idea:

uint8_t sendATcommand(const char* ATcommand, const char* expected_answer, unsigned int timeout)
{
  uint8_t x = 0, answer = 0;
  char response[100];
  unsigned long previous;

  memset(response, '\0', 100); // Initialize the string

  delay(100);

  while (SIM7600Serial->available() > 0) { // Clean the input buffer
    SIM7600Serial->read();
  }

  SIM7600Serial->println(ATcommand);    // Send the AT command

  x = 0;
  previous = millis();

  // This loop waits for the answer
  do {
    if (SIM7600Serial->available() != 0) {
      // if there are data in the UART input buffer, reads it and checks for the answer
      response[x] = SIM7600Serial->read();
      Serial.print(response[x]);
      x++;
      // check if the desired answer is in the response of the module
      if (strstr(response, expected_answer) != NULL) {
        answer = 1;
      }
    }
    // Waits for the asnwer with time out
  } while ((answer == 0) && ((millis() - previous) < timeout));

  // SIM7600Serial->print("\n");
  return answer;
}

bool GPSPositioning()
{
  uint8_t answer = 0;
  bool RecNull = true;
  int i = 0;
  char RecMessage[200];
  char LatDD[3], LatMM[10], LogDD[4], LogMM[10], DdMmYy[7] , UTCTime[7];
  int DayMonthYear;
  Lat = 0;
  Log = 0;

  memset(RecMessage, '\0', 200); // Initialize the string
  memset(LatDD, '\0', 3); // Initialize the string
  memset(LatMM, '\0', 10); // Initialize the string
  memset(LogDD, '\0', 4); // Initialize the string
  memset(LogMM, '\0', 10); // Initialize the string
  memset(DdMmYy, '\0', 7); // Initialize the string
  memset(UTCTime, '\0', 7); // Initialize the string

  Serial.print("Start GPS session...\n");
  sendATcommand("AT+CGPS=1,1", "OK", 1000); // start GPS session, standalone mode

  delay(2000);

  while (RecNull) {
    answer = sendATcommand("AT+CGPSINFO", "+CGPSINFO: ", 1000); // start GPS session, standalone mode

    if (answer == 1) {
      answer = 0;
      while (SIM7600Serial->available() == 0);
      // this loop reads the data of the GPS
      do {
        // if there are data in the UART input buffer, reads it and checks for the asnwer
        if (SIM7600Serial->available() > 0) {
          RecMessage[i] = SIM7600Serial->read();
          i++;
          // check if the desired answer (OK) is in the response of the module
          if (strstr(RecMessage, "OK") != NULL) {
            answer = 1;
          }
        }
      } while (answer == 0);   // Waits for the asnwer with time out

      RecMessage[i] = '\0';
      Serial.print(RecMessage);
      Serial.print("\n");

      if (strstr(RecMessage, ",,,,,,,,") != NULL) {
        memset(RecMessage, '\0', 200);    // Initialize the string
        i = 0;
        answer = 0;
        delay(1000);
      }
      else {
        RecNull = false;
        sendATcommand("AT+CGPS=0", "OK:", 1000);
      }
    }
    else {
      Serial.print("error \n");
      return false;
    }
    delay(2000);
  }

  strncpy(LatDD, RecMessage, 2);
  LatDD[2] = '\0';

  strncpy(LatMM, RecMessage + 2, 9);
  LatMM[9] = '\0';

  Lat = atoi(LatDD) + (atof(LatMM) / 60);
  if (RecMessage[12] == 'N') {
    Serial.print("Latitude is ");
    Serial.print(Lat);
    Serial.print(" N\n");
  }
  else if (RecMessage[12] == 'S') {
    Serial.print("Latitude is ");
    Serial.print(Lat);
    Serial.print(" S\n");
  }
  else {
    return false;
  }

  strncpy(LogDD, RecMessage + 14, 3);
  LogDD[3] = '\0';

  strncpy(LogMM, RecMessage + 17, 9);
  LogMM[9] = '\0';

  Log = atoi(LogDD) + (atof(LogMM) / 60);
  if (RecMessage[27] == 'E') {
    Serial.print("Longitude is ");
    Serial.print(Log);
    Serial.print(" E\n");
  }
  else if (RecMessage[27] == 'W') {
    Serial.print("Latitude is ");
    Serial.print(Lat);
    Serial.print(" W\n");
  }
  else {
    return false;
  }

  strncpy(DdMmYy, RecMessage + 29, 6);
  DdMmYy[6] = '\0';
  Serial.print("Day Month Year is ");
  Serial.print(DdMmYy);
  Serial.print("\n");

  strncpy(UTCTime, RecMessage + 36, 6);
  UTCTime[6] = '\0';
  Serial.print("UTC time is ");
  Serial.print(UTCTime);
  Serial.print("\n");

  return true;
}
1 Like

Also, civilwill, there is an I2C bus brought out on the breakout pads at the bottom right corner of the main board. There is no connector soldered there, and if you add one it will stick out of the bottom of the phone. But there are many I2C compatible devices at Adafruit that you could hang off that bus and access via the Arduino Wire library. Adafruit has a GPS breakout module that is I2C compatible, but like I said in the previous post, I donā€™t think youā€™d need that because the SIM7600 should be able to do that (the SIM800 also, I would imagine because even 2G required GPS).

1 Like

Awesome! Thank you so much for your replies! This is super helpful. I really appreciate it. I was wondering if something like adafruit feathers would be useful here.

I fiddled around with the SIM7600 GPS commands and they seem to do what they say. However, Iā€™m never able to acquire a GPS lock (AT+CGPSINFO always returns 8 commas) and suspect that a separate GPS antenna must be connected to the center antenna connector on the module. But I donā€™t have such an antenna and probably canā€™t get one with that kind of coaxial connector anyway, so canā€™t continue the experiment further.

Frank, what about connecting another cell phone antenna to the center module connector. I have an extra that I could send you if you think it might work.

Thanks Kent, but I already tried that. I had a 2G antenna left over from a 2G unit that didnā€™t work well with T-Mobile GSM. Connected that and let it hang out the side of the phone, but no improvement.

This article: Read GPS data inside SIM7600E module shows in the picture a humpinā€™ huge active GPS antenna (not to mention a rather large cell phone antenna for receiving tracing pings relevant to the article). What I donā€™t understand is that my cheap Moto E5 phone clearly has no huge GPS antenna (it might have a tiny one internally), yet locks onto GPS quickly and well even without being on a cellular network (i.e.: standalone mode).

I send AT+CGPS=1,1 to turn on GPS in standalone mode (get back OK) and then AT+CGPSINFO every few seconds, put the phone in my front window where other phones get GPS reliably, but after minutes I still just get back the 8 commas indicating no lock. This even with the 2G antenna connected to the middle connector. Apparently GPS uses 1575.42Mhz, and maybe I need an antenna tuned to exactly that frequency (since GPS satellite signals are quite weak). Donā€™t know where to get one with this kind of connector though.

I can send you my test program if youā€™d like.

Thanks Frank, but that would be well above my level of understanding. I am interested in your results though, and any progress made.