├── .DS_Store ├── LICENSE ├── README.md ├── doc ├── BoardManager.png ├── SNOC-wisol-schematics.png ├── SerialConsole.png ├── SigfoxBackend.png ├── arduino-uno.jpg ├── connexion_gpio.png ├── wiring1.jpg ├── wiring2.jpg └── wiring3.jpg └── sigfox-hello-world └── sigfox-hello-world.ino /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/.DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Louis MOREAU 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # arduinoUno-wisol 2 | How to send a Sigfox "Hello World" with Arduino Uno and Sigfox Wisol module 3 | 4 | ## Hardware Requirements 5 | * Arduino Uno 6 | * [SNOC Breakout Board - Sigfox BRKWS01](https://yadom.fr/carte-breakout-sfm10r1.html) 7 | 8 | ## Module Schematics 9 | 10 | * SNOC Breakout Board: 11 | ![SNOC](doc/SNOC-wisol-schematics.png) 12 | 13 | * Arduino Uno: 14 | ![Arduino Uno](doc/arduino-uno.jpg) 15 | 16 | ## Wiring 17 | 18 | ![Wiring](doc/connexion_gpio.png) 19 | Thank you [framboise314](http://www.framboise314.fr/carte-de-prototypage-sigfox-par-snoc/) for this connection picture! 20 | 21 | ![](doc/wiring3.jpg) 22 | 23 | ![](doc/wiring1.jpg) 24 | 25 | ![](doc/wiring2.jpg) 26 | 27 | 28 | ## Install Arduino IDE 29 | 30 | * Get the lastest arduino IDE [here](https://www.arduino.cc/en/main/software). 31 | * Go to Tools > Boards 32 | * Select the Arduino/Guenuino Uno 33 | 34 | 35 | ## Send your first message - Hello World 36 | 37 | With Sigfox, "Hello World" is to send a "CAFE" or "C0FFEE" message in hexadecimal. 38 | 39 | Copy past this code in a new project (or open sigfox-hello-world.ino in the repository you've just cloned): 40 | 41 | ```cpp 42 | /* 43 | * Author: Louis Moreau: https://github.com/luisomoreau 44 | * Date: 2017/03/03 45 | * Description: 46 | * This arduino example will show you how to send a Sigfox message 47 | * using the wisol module and the arduino UNO (https://yadom.fr/carte-breakout-sfm10r1.html) 48 | */ 49 | 50 | // include the SoftwareSerial library so you can use its functions: 51 | #include 52 | 53 | #define rxPin 10 54 | #define txPin 11 55 | 56 | 57 | // set up a new serial port 58 | SoftwareSerial Sigfox = SoftwareSerial(rxPin, txPin); 59 | 60 | //Set to 0 if you don't need to see the messages in the console 61 | #define DEBUG 1 62 | 63 | //Message buffer 64 | uint8_t msg[12]; 65 | 66 | // the setup function runs once when you press reset or power the board 67 | void setup() { 68 | // initialize digital pin LED_BUILTIN as an output. 69 | pinMode(LED_BUILTIN, OUTPUT); 70 | 71 | if(DEBUG){ 72 | Serial.begin(9600); 73 | } 74 | 75 | // open Wisol communication 76 | // define pin modes for tx, rx: 77 | pinMode(rxPin, INPUT); 78 | pinMode(txPin, OUTPUT); 79 | Sigfox.begin(9600); 80 | delay(100); 81 | getID(); 82 | delay(100); 83 | getPAC(); 84 | } 85 | 86 | // the loop function runs over and over again forever 87 | void loop() { 88 | msg[0]=0xC0; 89 | msg[1]=0xFF; 90 | msg[2]=0xEE; 91 | 92 | sendMessage(msg, 3); 93 | 94 | // In the ETSI zone, due to the reglementation, an object cannot emit more than 1% of the time hourly 95 | // So, 1 hour = 3600 sec 96 | // 1% of 3600 sec = 36 sec 97 | // A Sigfox message takes 6 seconds to emit 98 | // 36 sec / 6 sec = 6 messages per hours -> 1 every 10 minutes 99 | delay(60000); 100 | } 101 | 102 | void blink(){ 103 | digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) 104 | delay(1000); // wait for a second 105 | digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW 106 | delay(1000); 107 | } 108 | 109 | //Get Sigfox ID 110 | String getID(){ 111 | String id = ""; 112 | char output; 113 | 114 | Sigfox.print("AT$I=10\r"); 115 | while (!Sigfox.available()){ 116 | blink(); 117 | } 118 | 119 | while(Sigfox.available()){ 120 | output = Sigfox.read(); 121 | id += output; 122 | delay(10); 123 | } 124 | 125 | if(DEBUG){ 126 | Serial.println("Sigfox Device ID: "); 127 | Serial.println(id); 128 | } 129 | 130 | return id; 131 | } 132 | 133 | 134 | //Get PAC number 135 | String getPAC(){ 136 | String pac = ""; 137 | char output; 138 | 139 | Sigfox.print("AT$I=11\r"); 140 | while (!Sigfox.available()){ 141 | blink(); 142 | } 143 | 144 | while(Sigfox.available()){ 145 | output = Sigfox.read(); 146 | pac += output; 147 | delay(10); 148 | } 149 | 150 | if(DEBUG){ 151 | Serial.println("PAC number: "); 152 | Serial.println(pac); 153 | } 154 | 155 | return pac; 156 | } 157 | 158 | 159 | //Send Sigfox Message 160 | void sendMessage(uint8_t msg[], int size) 161 | { 162 | Serial.println("Inside sendMessage"); 163 | 164 | String status = ""; 165 | String hexChar = ""; 166 | String sigfoxCommand = ""; 167 | char output; 168 | 169 | sigfoxCommand += "AT$SF="; 170 | 171 | for (int i = 0; i < size; i++) 172 | { 173 | hexChar = String(msg[i], HEX); 174 | 175 | //padding 176 | if (hexChar.length() == 1) 177 | { 178 | hexChar = "0" + hexChar; 179 | } 180 | 181 | sigfoxCommand += hexChar; 182 | } 183 | 184 | Serial.println("Sending..."); 185 | Serial.println(sigfoxCommand); 186 | Sigfox.println(sigfoxCommand); 187 | 188 | while (!Sigfox.available()) 189 | { 190 | Serial.println("Waiting for response"); 191 | delay(1000); 192 | } 193 | 194 | while (Sigfox.available()) 195 | { 196 | output = (char)Sigfox.read(); 197 | status += output; 198 | delay(10); 199 | } 200 | 201 | Serial.println(); 202 | Serial.print("Status \t"); 203 | Serial.println(status); 204 | } 205 | 206 | 207 | ``` 208 | 209 | You should get this result: 210 | ![](doc/SerialConsole.png) 211 | 212 | ## See your messages in Sigfox Backend 213 | 214 | ![Sigfox Backend](doc/SigfoxBackend.png) 215 | 216 | 217 | 218 | ## Additional content 219 | 220 | * [Framboise314](http://www.framboise314.fr/carte-de-prototypage-sigfox-par-snoc/) 221 | 222 | 223 | * [Tutos Instructables](www.instructables.com/member/luisomoreau/) 224 | 225 | 226 | * [Tutos Hackster](https://www.hackster.io/luisomoreau) 227 | -------------------------------------------------------------------------------- /doc/BoardManager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/BoardManager.png -------------------------------------------------------------------------------- /doc/SNOC-wisol-schematics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/SNOC-wisol-schematics.png -------------------------------------------------------------------------------- /doc/SerialConsole.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/SerialConsole.png -------------------------------------------------------------------------------- /doc/SigfoxBackend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/SigfoxBackend.png -------------------------------------------------------------------------------- /doc/arduino-uno.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/arduino-uno.jpg -------------------------------------------------------------------------------- /doc/connexion_gpio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/connexion_gpio.png -------------------------------------------------------------------------------- /doc/wiring1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/wiring1.jpg -------------------------------------------------------------------------------- /doc/wiring2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/wiring2.jpg -------------------------------------------------------------------------------- /doc/wiring3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisomoreau/arduinoUno-wisol/9550ddb465c313f4065baebc43a78703327ebe82/doc/wiring3.jpg -------------------------------------------------------------------------------- /sigfox-hello-world/sigfox-hello-world.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Louis Moreau: https://github.com/luisomoreau 3 | * Date: 2017/03/03 4 | * Description: 5 | * This arduino example will show you how to send a Sigfox message 6 | * using the wisol module and Arduino UNO (https://yadom.fr/carte-breakout-sfm10r1.html) 7 | */ 8 | 9 | // include the SoftwareSerial library so you can use its functions: 10 | #include 11 | 12 | #define rxPin 10 13 | #define txPin 11 14 | 15 | 16 | // set up a new serial port 17 | SoftwareSerial Sigfox = SoftwareSerial(rxPin, txPin); 18 | 19 | //Set to 0 if you don't need to see the messages in the console 20 | #define DEBUG 1 21 | 22 | //Message buffer 23 | uint8_t msg[12]; 24 | 25 | // the setup function runs once when you press reset or power the board 26 | void setup() { 27 | // initialize digital pin LED_BUILTIN as an output. 28 | pinMode(LED_BUILTIN, OUTPUT); 29 | 30 | if(DEBUG){ 31 | Serial.begin(9600); 32 | } 33 | 34 | // open Wisol communication 35 | // define pin modes for tx, rx: 36 | pinMode(rxPin, INPUT); 37 | pinMode(txPin, OUTPUT); 38 | Sigfox.begin(9600); 39 | delay(100); 40 | getID(); 41 | delay(100); 42 | getPAC(); 43 | } 44 | 45 | // the loop function runs over and over again forever 46 | void loop() { 47 | msg[0]=0xC0; 48 | msg[1]=0xFF; 49 | msg[2]=0xEE; 50 | 51 | sendMessage(msg, 3); 52 | 53 | // In the ETSI zone, due to the reglementation, an object cannot emit more than 1% of the time hourly 54 | // So, 1 hour = 3600 sec 55 | // 1% of 3600 sec = 36 sec 56 | // A Sigfox message takes 6 seconds to emit 57 | // 36 sec / 6 sec = 6 messages per hours -> 1 every 10 minutes 58 | delay(60000); 59 | } 60 | 61 | void blink(){ 62 | digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) 63 | delay(1000); // wait for a second 64 | digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW 65 | delay(1000); 66 | } 67 | 68 | //Get Sigfox ID 69 | String getID(){ 70 | String id = ""; 71 | char output; 72 | 73 | Sigfox.print("AT$I=10\r"); 74 | while (!Sigfox.available()){ 75 | blink(); 76 | } 77 | 78 | while(Sigfox.available()){ 79 | output = Sigfox.read(); 80 | id += output; 81 | delay(10); 82 | } 83 | 84 | if(DEBUG){ 85 | Serial.println("Sigfox Device ID: "); 86 | Serial.println(id); 87 | } 88 | 89 | return id; 90 | } 91 | 92 | 93 | //Get PAC number 94 | String getPAC(){ 95 | String pac = ""; 96 | char output; 97 | 98 | Sigfox.print("AT$I=11\r"); 99 | while (!Sigfox.available()){ 100 | blink(); 101 | } 102 | 103 | while(Sigfox.available()){ 104 | output = Sigfox.read(); 105 | pac += output; 106 | delay(10); 107 | } 108 | 109 | if(DEBUG){ 110 | Serial.println("PAC number: "); 111 | Serial.println(pac); 112 | } 113 | 114 | return pac; 115 | } 116 | 117 | 118 | //Send Sigfox Message 119 | void sendMessage(uint8_t msg[], int size) 120 | { 121 | if(DEBUG){ 122 | Serial.println("Inside sendMessage"); 123 | } 124 | 125 | 126 | String status = ""; 127 | String hexChar = ""; 128 | String sigfoxCommand = ""; 129 | char output; 130 | 131 | sigfoxCommand += "AT$SF="; 132 | 133 | for (int i = 0; i < size; i++) 134 | { 135 | hexChar = String(msg[i], HEX); 136 | 137 | //padding 138 | if (hexChar.length() == 1) 139 | { 140 | hexChar = "0" + hexChar; 141 | } 142 | 143 | sigfoxCommand += hexChar; 144 | } 145 | 146 | if(DEBUG){ 147 | Serial.println("Sending..."); 148 | Serial.println(sigfoxCommand); 149 | 150 | } 151 | 152 | 153 | while (!Sigfox.available()) 154 | { 155 | if(DEBUG){ 156 | Serial.println("Waiting for response"); 157 | } 158 | 159 | delay(1000); 160 | } 161 | 162 | while (Sigfox.available()) 163 | { 164 | output = (char)Sigfox.read(); 165 | status += output; 166 | delay(10); 167 | } 168 | 169 | if(DEBUG){ 170 | Serial.println(); 171 | Serial.print("Status \t"); 172 | Serial.println(status); 173 | } 174 | 175 | } 176 | --------------------------------------------------------------------------------