Hi @louisakgh,
Glad to see you’re moving ahead with your SCK. I checked your data posts, and yes, the updates are being received. It takes a few days for the “no data received yet” to go away.
To get to the point you are at now, I’m guessing you registered and added your SCK via the tools found on smartcitizen.me. You will need to go through part of that again, but in the Arduino IDE.
Open Arduino IDE.
Connect your SCK via USB.
At the top of the IDE screen, got to Tools > Board > select LilyPad Arduino USB. Then Tools > Port > choose the USB port your SCK is connect to. Then File > Open > sck_beta_v0_9.ino (this file will be in the ones you downloaded from GitHub. Smart-Citizen-Kit-Master > sck_beta_v0_9 > sck_beta_v0_9.ino)
OK, when loaded, you should be on the first tab labeled “sck_beta_v0_9”
You will want to navigate to the “Constants.h” tab (should be the third tab).
Scroll down until you get to the section of code titled “WIFLY Firmware Setting” (the first line in this section is “#define networks 0”). You are going to need to change some of these defaults to match what you already entered when you registered and enrolled your SCK on the website.
First change:
#define networks 0
to
#define networks 1
(Here you’re telling the code that you want to connect to 1 network rather than 0 networks.)
Next change:
static char* mySSID[networks] = {
“SSID1” , “SSID2” , “SSID3” };
to
static char* mySSID[networks] = {
“MyWifiSSID” };
(But use your personal wifi SSID, not MyWifiSSID. Here you’re telling the code the name of the network that you want to connect to.)
Next change:
static char* myPassword[networks] = {
“PASS1” , “PASS2” , “PASS3” };
to
static char* myPassword[networks] = {
“MyPassword” };
(But use your personal wifi password, not MyPassword. Here you’re telling the code the password for the network that you want to connect to.)
Next change:
static char* wifiEncript[networks] = {
WPA2 , WPA2 , WPA2 };
to
staticchar* wifiEncript[networks] = {
WPA2 };
(But use your type of wifi encryption, which may or may not be WPA2. Your options are: Open, WEP, WPA1, WPA2, and WEP64. Here you’re telling the code the type of wifi encryption for the network that you want to connect to.)
Last change for the network settings:
static char* antennaExt[networks] = {
INT_ANT , INT_ANT , INT_ANT };
to
static char* antennaExt[networks] = {
INT_ANT }; //EXT_ANT
(But use your type antenna, which may or may not be the internal chip antenna. Your options are: INT_ANT, and EXT_ANT. Unless you’ve connected an external antenna to you SCK, use INT-ANT. Here you’re telling the code the type of antenna you’re SCK is using to use to connect to your network.)
When you’re done modifing the generic code with your specific info, it should look something like this:
#define networks 1
#if (networks > 0)
static char* mySSID[networks] = {
“MyWifiSSID” };
static char* myPassword[networks] = {
“MyPassword” };
static char* wifiEncript[networks] = {
WPA2 };
static char* antennaExt[networks] = {
INT_ANT }; //EXT_ANT
#endif
OK, are you still with me? Not hard, but using the website is much easier. Now we can make the changes you came her for: DEFAULT_MODE_SENSOR.
Scroll down until you get to this line of code: #define DEFAULT_TIME_UPDATE. You will see four lines of code in this section:
#define DEFAULT_TIME_UPDATE 60
(Here you’re telling the code to gather reading from each of the sensors every 60 seconds and compile those readings into an update. If your goal is to conserve battery life, you can change the “60” seconds to a longer time-frame.)
#define DEFAULT_MIN_UPDATES 1
(Here you’re telling the code to post the compiled sensor update every time the readings are taken. Each time you post your updates, the SCK has to “Wake-up” the wifi and confirm a signal connection. If your goal is to conserve battery life, you can change the “1” update to a wait until the SCK has many updates to post. I don’t know how much on-board memory the SCK has to dedicate to the updates, but I would expect to to be a ton.)
#define POST_MAX 20
(Here you’re telling the code the max number of updates sent over wifi during a single post is 20. If you change the DEFAULT_MIN_UPDATE in the previous line to something greater than the value used for POST_MAX, you will always be losing data. The only time I can think this value will be useful is if you lose your wifi connection. Since the SCK will keep gathering sensor readings and compiling updates even without a wifi connection, the SCK will want to post those updates when a connection is re-established.)
#define DEFAULT_MODE_SENSOR NORMAL //Type sensors capture (OFFLINE, NOWIFI, NORMAL, ECONOMIC)
(Here you’re telling the code that the your SCK is in NORMAL operation. If you change it to ECONOMIC, the SCK gas sensor will only take readings once per hour. Note: the gas sensor works by heating a small circuit. This heating draws a ton of energy, and that’s why the ECONOMIC mode results in longer battery life)
OK, so your code should now look something like this:
#define DEFAULT_TIME_UPDATE 60 //Time between update and update
#define DEFAULT_MIN_UPDATES 1 //Minimum number of updates before posting
#define POST_MAX 20 //Max number of postings at a time
#define DEFAULT_MODE_SENSOR ECONOMIC //Type sensors capture (OFFLINE, NOWIFI, NORMAL, ECONOMIC)
You’re now done modifying the code. Go to the top of the IDE screen, File > Save. Then click on the circle with the check-mark (doing this will verify you have valid code and will pu it all together to be uploaded). Now click on the circle with the arrow (right next to the circle with the check-mark), this will upload the code to your SCK.
Congratulations. You’re done.
Let me know if you get stuck along the way. Good luck.
-Matt
SCK 685