The Photon maker kit came with all kinds of great sensors. It was the most fun to setup because I could immediately turn on/off a LED from my iPhone. However there’s no instructions for any of the other sensor project. No book, no manual. Not even the website has a maker kit guide that tells you how to build a project with each of the components. Nothing that tells you that it’s based around javascript. I followed all the online guides. My disappointed centered around wanting to build a temp sensor to drop in my aquarium tank. Not only could I not go to a manual that told me step-by-step how to use the included waterproof thermometer, but a lot of people couldn’t even find/get libraries working for it. All the examples were written by 3rd parties for the older sensors, and none had a great breadboard layout. I still can’t get it working. I can’t use any of the parts in the box.
But at least I have a $100 kit that can turn on an LED. I’m pretty disappointed. The aurdino kit came with a book with over 80 projects and complete illustrations for each project.
I just want to use the waterproof temp sensor to measure aquarium water. Not one official guide will tell me how to use the items in the kit. Every part that ships to me should have a webpage that step by step shows me how to build something with the LCD panel, or the ultrasonic sensor, and so forth.
The kit will collect dust, since I couldn’t find a basic “learn to code for this”, more of just copy this code into your file and it will do this.
I think the hardware is fantastic. This thing is way superior to the aurdino. However the Aurdino makes it easy, and clear to figure out what’s going on.
Thanks for the feedback too (although Elites are no Particle employees ;-)).
I can understand your disappointment, since it would be nice to have these resources, but - you know - time, a relatively small team and all these other things to do, prevent Particle from supplying this.
But one good thing came from that: You got in contact with this awesome community, that will help you out wherever we can - promised
And as Kenneth said, volunteers are permanently working on tutorials.
A book has been written for the photon, and has quite a few easy projects in it to get you started, should you be interested.
Because it's really hard to do that for every item. The difficulty lies in the fact that there are so many different things you could do with them. Making a full project with each and every component would be extremely time consuming, and still wouldn't cover every possibility. Rather than doing that, some 'general' examples would be more appropriate.
Per component, show how it's supposed to be hooked up.
Per component, have some simple example code.
Have an example on how to communicate with any variable or any function.
Have an example on how to combine these.
Considering the API is accessible over a REST interface, it's not really true to say that:
A REST API can be accessed by pretty much any programming language. Javascript is one of the 'obvious' web languages, but most others should work just fine.
Would you mind telling us which ones, so we can have a look and see what could be improved on those? The tutorials by @bko in the tutorial section of the forum have always been of great help. Definitely worthwhile checking out :)!
That's kind of what being open source is about Input from the community is incredibly valuable, since there are limited resources available at any given time. Arduino, for example, has been around a lot longer, and have thus had more time to come up with more resources. Not to mention that they have a community of millions, and many of their contributions come from those members as well.
Much like I argued before, creating a project for every component might seem useful, but would still leave out a lot of possibilities, as well as be extremely time/resources consuming. Rather, giving you the building blocks for each of the required components, should allow you to build your own project. On the device side, you get some example code to get the basic functionality working. Then there are guides available on how to extract that data over the REST API. What you then choose do with that data is up to you, as is the programming language you'd like to use.
For each of these individual pieces, guides can be created, and I personally think that'd be more useful than 'complete' projects. Mind you, if you've got a project you're willing to share, then by all means do, much like a lot of people have already done in the "project share" category or the hackster page. Again, this is a community effort
So, all that aside, I can't but agree with you that more examples should be made available. I also think the components in the Maker kit should be officially supported by Particle. That's something that's been brought up before, and if I'm not mistaken, that's something they're looking into.
Now, as for your DS18B20, let me try to give you a mini-guide
Hooking it up
The sensor has three cables coming out of it, Ground (black), Power (red), and Data (yellow). Connect those in a breadboard to your Photon as shown in the image below. (The image shows the non-waterproof variant, so just match up the colors of the wires). We're using D2 since that's what's defined in the example later on, we'll get to that in a bit.
The resistor shown there is 4.7kΩ. That specific value isn't in the Maker kit, but you can use two 10kΩ resistors in parallel which are present. They have to be connected from Data (yellow) to Power (red).
For the code, we're going to use a (community made) library from the Web IDE. Once you're logged in there, go to the library section, and search for "ds18b20" and select the corresponding library:
Once that's opened, select "USE THIS EXAMPLE". A new project will be created with the example code ready to go. I'll put it here below with some additional comments. (Don't simply copy&paste this, since it will miss the necessary library)
#include "DS18B20/Particle-OneWire.h" // load the OneWire library
#include "DS18B20/DS18B20.h" // load the DS18B20 libarary
DS18B20 ds18b20 = DS18B20(D2); //Sets Pin D2 for Water Temp Sensor, why we used D2
int led = D7; // no obvious reason why that's here. Useful for testing as it's on-board.
char szInfo[64];
float pubTemp;
double celsius; //
double fahrenheit;
unsigned int Metric_Publish_Rate = 30000;
unsigned int MetricnextPublishTime;
int DS18B20nextSampleTime;
int DS18B20_SAMPLE_INTERVAL = 2500;
int dsAttempts = 0;
void setup() {
Time.zone(-5);
Particle.syncTime();
pinMode(D2, INPUT);
// Exposes the fahrenheit variable to the cloud as tempHotWater.
Particle.variable("tempHotWater", &fahrenheit, DOUBLE);
Serial.begin(115200);
}
void loop() {
if (millis() > DS18B20nextSampleTime){
getTemp();
}
if (millis() > MetricnextPublishTime){
Serial.println("Publishing now.");
publishData();
}
}
// Function that will SSE publish to the cloud
void publishData(){
if(!ds18b20.crcCheck()){
return;
}
sprintf(szInfo, "%2.2f", fahrenheit);
// publish a private event with name "dsTmp" and data "szInfo"
Particle.publish("dsTmp", szInfo, PRIVATE);
MetricnextPublishTime = millis() + Metric_Publish_Rate;
}
// This is what gets the temperature from the sensor.
void getTemp(){
if(!ds18b20.search()){
ds18b20.resetsearch();
celsius = ds18b20.getTemperature();
Serial.println(celsius);
while (!ds18b20.crcCheck() && dsAttempts < 4){
Serial.println("Caught bad value.");
dsAttempts++;
Serial.print("Attempts to Read: ");
Serial.println(dsAttempts);
if (dsAttempts == 3){
delay(1000);
}
ds18b20.resetsearch();
celsius = ds18b20.getTemperature(); // gets temperature in Celcius
continue;
}
dsAttempts = 0;
fahrenheit = ds18b20.convertToFahrenheit(celsius); // converts to Fahrenheit
DS18B20nextSampleTime = millis() + DS18B20_SAMPLE_INTERVAL;
Serial.println(fahrenheit);
}
}
Honestly, I don't know how the library works either. The great thing: I don't have to. The most important things are available in the example: getting the temperature. That's done by using the celsius = ds18b20.getTemperature(); function and fahrenheit = ds18b20.convertToFahrenheit(celsius); depending on what system you'd like to use.
Obviously, there are some other things going on in the getTemp() functions, but that function as a whole can be used in other code without having to know exactly what it does. There's a bit of error handling in there, which is nice.
I know this sounds bit vague, so let me know if further clarification is required.
Anyhow, the rest of the example consist of exposing variables to the cloud as well as publishing values using Server Sent Events, which you can subscribe to.
The loop() uses some rate limiting to make sure you're not reading the sensor non-stop, and more importantly, not crossing the publish rate-limit (1p/s, bursts of 4p/s allowed). It's using a non-blocking 'soft-delay' which doesn't block other processes.
Getting the data over the internet
Here's the part where it get difficult to create an example for since the data can be handled in A LOT of way. One of them is a web interface using JavaScript. For that, a great tutorial has already been made by @bko. With a few minor tweaks to his code, you should be able to get this running rather easily.
Should you want to use the SSEs, then you can use another one of his tutorials.
The exposed variable is also accessible if you use your browser to navigate to https://api.particle.io/v1/devices/[DeviceID_here]/temp?access_token=[Accesstoken_here].
The SSEs are available if you go to https://api.spark.io/v1/devices/events/?access_token=[Accesstoken_here]
Easy access to your functions/variables/events can be had on this page as well
Now, what you do with the data is up to you, and providing you with examples on how to do that is outside the scope of this community I think.
The above should help get you up and running with at least that sensor. Should anything be unclear, or require further explanation, then please do let us know, and we'll see what we can do.
Unfortunately AFAIK there isn’t one (yet), but if you are using the SSD1306 library on Particle Build (aka Web IDE), you’ll get it up and running with just a few hints from this post Adafruit SSD1306 [SOLVED]
Connect all five pins as shown in the second gray box.
Another thing that comes in the Maker Kit is an extension antenna for wifi. Would be nice to have some sentence or two saying how to plug it in. It takes a lot of force and I was worried I was going to break something. And then since it seemed to have no effect on performance, how do you take it off? Some connectors in life cannot be UNplugged.
So after doing searches, I see that there’s a software way to switch between antennas. Q: Do I need to do that? How?
So I agree with OP: The Maker Kit is intended for new users and every item in the kit should have SOMETHING in it, some toy program, which builds confidence in the user by getting him to first base.
SparkFun’s kit has a Photon P1 on their Redboard breakout board, and some sensors are different, but you can adapt in many cases. There are excellent in-depth tutorials on sensors on SparkFun’s site too.
The Make: Getting Started with the Photon mentioned above book is excellent. The Kindle or iBooks version is much cheaper than the paper copy. I’m not much of a coder, so I also learned tons by working through the examples in the SAMs Teach Yourself Arduino Programming in 24 hours book.
The Photon is one of the most interesting components I have ever worked wiith.
See this is confusing to me. I’m using the long cabled waterproof thermometer. I was told, that you have to first get the 16 digit unique ID from the thermometer before you can use it. So you have to run a program, get the ID, then plug that into your program since every single 1-wire temp is unique?