Complete novice with Photon on the way

I am currently carrying out a Physics project and need a device to measure and record temperature over time. I am also very interested in making some other projects. After doing a bit of research, I decided to pre order the Spark Photon. I have almost no programming experience but I am very interested in learning. I have started a javascript course on codeacademy but ideally I would like to know what language I would need to write programs on the photon and an idea of whether writing a program like this is a realistic goal considering my position. I have literally no idea what I am doing so advice would be much appreciated.
James, a complete novice

The core and photon use C++ with some nice little functions to make it like the arduino language.

The main part of the code is already done, that gives the cloud connection and hardware stuff… i2c spi etc you just need to write your bit to make it do what you want

There are heaps of good examples on the forums to get you started


Glad to hear that you’ve chosen Spark to be your introduction into the wonders of physical computing(?) Since it was the first for me as well, I can truthfully say it’s great for beginners. Like stated above, the language is C++, which is always a good thing to learn. You’ll notice that there are a lot of similarities with Javascript, like (conditional) loops, variables and whatnot.
As far as your project goes, that is entirely doable, no doubt! If you check out the example page of the docs, you’ll notice the example of a temperature sensor. This should give you an idea of the code. Using that code, in combination with already existing online services, you’d have a logger up and running in no time! I’ve been using Atomiot for this very purpose, measuring temperature and humidity data for three months.
In effort to put an end to my rambling: Language is C++, your projects is very doable, keep on learning Javascript (nodejs), feel free to ask for help if you feel you need any. If you’ve got an arduino laying around, or can get your hands on one easily, then play a round with it for a bit. The code is mostly compatible, and it will give you a feel for programming while you await your photon :slight_smile:


@Hootie81 is correct your project is a super easy one to do and the key is to use the site search. It works well and there are at least a half dozen references to get you started.

The Spark Language is not that alien if you can code in PHP, JS or C you will figure it out quick

1 Like

Hah we both replied at the same time :smile:


And same goes the other way too as @Herner says… if you know the basics of C++ then other languages like PHP and JS are also easier to pick up. and you may find you will need a few languages along the way too.

the Atomiot thing above that @Moors7 mentioned is easy to setup and use, if your wanting a totally custom temperature logging service you could create a “LAMP” stack which is a server running Linux, Apache, MySQL and PHP. then write a small PHP script to store the data in the database. that way its totally customizable to suit your needs. I now have a few projects which i use C++ on the core and PHP/MySQL on my server.

1 Like

True indeed. I’ve been getting programming classes in which we’re being thought C, and it’s all very familiar. With the rise of node.js I suggest you keep on doing JavaScript, since that’ll be a big help in any web based applications.

Also, if you’re making a ‘stack’ anyway, why don’t you go for the MEAN stack (MongoDB, ExpressJS, AngularJS, NodeJS)? They work great together, and you can get amazing boiler plates for them. Apart from that, it will save you of having to learn several different languages, since it all runs on JavaScript.
Mind you, HTML5 and CSS3 is something you’ll have to learn anyhow, if you’re planning on making decent web apps, so that’s the same for either of the stacks. The nice thing about the MEAN stuff is that you have total control of any things that happens, and it’s greatly compatible with the IoT since it can handle a lot of requests simultaneously. And the fact that it’s ‘merely’ one language is benificial as well, since you don’t have to worry about code compatibility, and conversions.
It all seems spooky and alien at first, with most of my thoughts being:“I have no idea what I’m doing”, but if you put your mind to it, it should be doable (after a while :stuck_out_tongue:)

Like I said, feel free to ask for help if you need any. This community is a rather helpful bunch, and we’re glad to help out!

1 Like

@Moors7 @Hootie81 @Herner
Firstly, thank you for the quick replies everyone. It’s good to know there’s somewhere with answers.
I will definitely look at those examples on the examples page and I have found a few sites with C++ tutorials.
Hopefully I can find an arduino cheap somewhere too.
When you talk about cloud connection, does that mean I could access my data on a webpage or something remotely (I’m completely new to this)? What kind of things would I need to do to get this going if so?
Also, (another stupid question coming…) what do you mean by a “stack” and a boiler plate?
Thanks again everyone and I’ll most certainly be back needing more help! :smile:

The spark has a cloud FREE as part of your purchase. All the variables in your code can be exposed and you can then access them remotely. in my case with a few hours of code I was able to build a thermostat that I control from my phone without the need for anything at all fancy.

I am not a spark guru at all I am a newbie but one that is absorbing information and starting to get dangerous :smile:

1 Like

Glad I could help!
The examples in the docs are neat, but definitely don’t forget to take a look at the awesome tutorials in the tutorial section. They’ve been a great help when I was starting out, and I still reference them every once in a while.
Cheap Arduino (clones) can be had for around €7/$10 on ebay, or some Chinese webstores (miniinthebox, dealextreme, etc). They’re nice to get started, and play around with the language a bit. Don’t spend too much on them though, since you probably won’t touch it very often anymore, after you get your Photon(s).

The Cloud connection is what makes the Spark devices even more awesome. It takes away all the difficult network related issues, and allows you to focus on functionality. Instead of having to deal with networking, you’re presented with a neat REST API, which you can use with virtually every programming language. This is interesting, since this indeed allows you to access your data remotely, through any network enabled device. What you need in order to get it running depends on the language you’re using, and what your goals are. I’ve made a simple JavaScript page which shows you your Cores, their status, their functions, and their variables. It’s all very basic, mostly since I just wanted to try out the Javascript library. Using NodeJS for example you can improve on this and make it as fancy as you’d like it to be.
I’d like to think of a ‘stack’ as a collection of things that build on each other, complement each other, well, ‘stack’ on each other. In case of the MEAN stack, that would be MongoDB, ExpressJS, AngularJS and NodeJS. In case of the LAMP stack, that’d be Linux, Apache, MySQL, and PHP.
A boilerplate is a preconfigured combination of these stacks, to make them easier to use. There is for example, which provides the configuration for the MEAN stack, which should get your up and running much more quickly.
Anyhow, this might be a bit black magic at the moment, but you’ll get there. It just takes some effort, and some cursing, and a lot of faulty code, but it’ll be worth it :wink:


Whoa, so you effectively have your own url for all your devices? How do you get it online and everything? Where do I start? What will I need?
I’m looking into those Arduino clones too, so I’ll have something to play around with.

That’s good. Is this the same as @Moors7 's javascript page? Haha, how long have you been doing this sort of thing?

You can access your devices through a combination of your Accesstoken and DeviceID. Using these with the REST API will allow you to control them. I think this might be useful to take a look through. It explains the general concepts, and the first steps into the wonders of all that is Spark. Also, the hacksters page might give you an idea of what is possible, and what might be required. As far as ‘needing’ things goes, that all depends on what you’re planning to make. An LED Christmas tree will require other stuff than a beer brewing machine, so that varies.
Don’t bust your head on those Arduinos, they’re merely to waste some time on while waiting for your Sparks. You probably won’t use it any more once those are in. I just bought the cheapest Uno R3 I could find…

I highly doubt @Herner 's page is the same since this is the first time I shared it :wink: I made it only to try out the SparkJS library, and to test some of the functions quickly. So far, so good.
Not sure who you’re referring to, but I guess I’ve been doing this for about a year. I’ve had some prior experiences with HTML/CSS, but nothing really in-depth.

1 Like

My code I am quite sure looks nothing like @Moors7 as well :slight_smile: nice of you to share that example for him Moors.

My code is for a custom smart control and it resides on a private server I control and it also passes data to ubidots which I in turn am integrating into it


Thank you so much for all your help and tips. They have been very useful. :smile: