Back to Smartcitizen.me

Use Arduino as device


#1

Hi all,
is there any guide that describes how to use a standard Arduino (plus Eth Shield or an Arduino YUN) instead of the SCK?
Thanks
M


#2

Hi @pitusso,
The SmartCitizen GITHUB site (https://github.com/fablabbcn/Smart-Citizen-Kit) has most of what you’ll need, but since I haven’t built one from scratch, I’m not sure if it has everything. The SCK 1.0 was based on the Arduino Leonardo, and the SCK 1.1 on the Arduino Lilypad. I don’t have enough experience using the Arduino IDE (http://arduino.cc/en/main/software) to know what the difference is, but but I’m guessing that there is one, and it will be slightly different from an UNO or YUN as well.
-Matt


#3

Thanks @rohwer for your reply.
I already looked at the source code posted in the github repo, and it’s optimized for the specific hw.

I think that a simple example (here: http://api.smartcitizen.me/) on how to POST data using API, should be enought.
Is there documentation about that?

Thanks
M


#4

I’m not sure I understand your question. If you’re trying to visualize the date on another platform, check out this forum discution: https://forum.smartcitizen.me/index.php?p=/discussion/1195/use-sck-data-with-other-dashboards#latest Sorry if this isn’t what your looking for.
-Matt


#5

Hi,
maybe i didn’t explain well what i mean!
In the API page, there are a lot of example on how to retrieve data from SmartCitizen.
I wonder how i can post data in SmartCitizen using API instead.


#6

Sorry, but that’s beyond my level of programming knowledge. @aitoraloa or @mdeheras might know which bits of code you can use or if you will need to write new code from scratch.
-Matt


#7

Hi and thanks.
It’s not a problem for me write code, but i’d like to have an example of the API post!

E.g.: with this url i can retrieve the latest data:
http://api.smartcitizen.me/v0.0.1/6e0428e19cf2bff1a9c05d14d0400bf4/lastpost.json
and output format is in json.
Which url to use to post data?


#8

This is the best I can find to answer your question: http://data.smartcitizen.me/add

I found it at: https://github.com/fablabbcn/Smart-Citizen-Kit/blob/master/sck_beta_v0_9/Constants.h , toward the bottom of the code (Line 215).

// Basic Server Posts to the SmartCitizen Platform - EndPoint: http://data.smartcitizen.me/add
static char* WEB[8]={
data.smartcitizen.me”,
"PUT /add HTTP/1.1
",
"Host: data.smartcitizen.me
",
"User-Agent: SmartCitizen
",
"X-SmartCitizenMacADDR: ",
"X-SmartCitizenApiKey: ",
"X-SmartCitizenVersion: ",
"X-SmartCitizenData: "};


#9

@rohwer it seems exactly what i need to start!
Thanks a lot


#10

@rohwer i found also this thread: https://forum.smartcitizen.me/index.php?p=%2Fsearch&Search=curl
that is very helpful on what i’m doing.
I’m testing the api post using curl indeed.