I’ve got an electron in a area with poor cell coverage. The provided taoglas antenna is working but the db is about -110.
I want to add a yagi antenna.
Is there a way to determine if my current connection is 2100mhz or 900mhz so I can get the correct antenna?
Thanks
I noticed that the 3G in north america is:
Electron U260 3G with 2G fallback North and South America, Australia 850/1900
So my revised question - can I determine if I’m communicating at 850 or 1900?
I’m not very familiar with antenas but couldn’t you get one that uses both frequencies.
I won’t guarantee this will work. I worked for me on a 3G Electron U260. I know it doesn’t work for 2G or 3G falling back to 2G; that’s left as an exercise for the reader.
Just flash this to your Electron and open a serial window. About 10 seconds after breathing cyan it will output some data. It repeats the process every 60 seconds.
The last line will be something like this:
UMTS 850 MHz
The code:
#include "Particle.h"
const unsigned long CHECK_PERIOD_MS = 60000;
unsigned long lastCheck = 10000 - CHECK_PERIOD_MS;
int cellularCallback(int type, const char* buf, int len, char* parsedResponse);
int ulf = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
if (millis() - lastCheck >= CHECK_PERIOD_MS) {
lastCheck = millis();
char parsedResponse[32];
parsedResponse[0] = 0;
Serial.println("requesting data");
// 7.21 Cell environment description +CGED
// 3 = one-shot serving cell dump
int ret = Cellular.command(cellularCallback, parsedResponse, 10000, "AT+CGED=3\r\n");
if (ret == RESP_OK) {
if (ulf != 0) {
if (ulf >= 0 && ulf <= 124) {
Serial.println("GSM 900 MHz");
}
else
if (ulf >= 128 && ulf <= 251) {
Serial.println("GSM 850 MHz");
}
else
if (ulf >= 512 && ulf <= 885) {
Serial.println("DCS 1800 MHz");
}
else
if (ulf >= 975 && ulf <= 1023) {
Serial.println("ESGM 900 MHz");
}
else
if (ulf >= 33280 && ulf <= 33578) {
Serial.println("PCS 1900 MHz");
}
else
if (ulf >= 1312 && ulf <= 1513) {
Serial.println("UMTS 1700 MHz");
}
else
if (ulf >= 2712 && ulf <= 2863) {
Serial.println("UMTS 900 MHz");
}
else
if (ulf >= 4132 && ulf <= 4233) {
Serial.println("UMTS 850 MHz");
}
else
if ((ulf >= 4162 && ulf <= 4188) || (ulf >= 20312 && ulf <= 20363)) {
Serial.println("UMTS 800 MHz");
}
else
if (ulf >= 9262 && ulf <= 9538) {
Serial.println("UMTS 1900 MHz");
}
else
if (ulf >= 9612 && ulf <= 9888) {
Serial.println("UMTS 2100 MHz");
}
}
else {
Serial.printlnf("error, did not find ULF (may be using 2G)");
}
}
else {
Serial.printlnf("command returned error ret=%d", ret);
}
}
}
int cellularCallback(int type, const char* buf, int len, char* parsedResponse)
{
// Make a mutable copy of the data and null terminate it
char *mutableCopy = (char *) malloc(len + 1);
strncpy(mutableCopy, buf, len);
mutableCopy[len] = 0;
Serial.printlnf("type=0x%x data=%s", type, mutableCopy);
char *pair = strtok(mutableCopy, ",");
while(pair) {
char *key = pair;
while(*key == ' ') {
key++;
}
char *value = strchr(pair, ':');
if (value) {
*value++ = 0;
// Have a key:value pair
if (strcmp(key, "ULF") == 0) {
ulf = atoi(value);
}
}
pair = strtok(NULL, ",");
}
free(mutableCopy);
return WAIT;
}
2 Likes
Thanks so much ! I’ll give this a try and report back.