Help novice with photon

I just started to know the particle photon. I bought 2 photons and I will like to register 1 data of each of them on my own website, registering them in a database.
I have read several documents and can not find a solution that covers this.
I have read about webhook, curl, https, etc. but I can not find a recommended solution or an example.
I would appreciate if someone could tell me which is the correct way or at least the best way to do this.
Thanks.

There is no ā€˜bestā€™ way to do this, since the options are plenty. It depends on your setup and need. The methods you mentioned are all equally valid.
Start simple (there are some examples in the tutorials section of both the forums as well as the docs), and work your way up from there?

1 Like

Thanks for the answer, I have not found any valid example using webhook and my own website, I have not found any example capturing data from more than one photon.
If you can indicate any post about this, I would appreciate it.

Hi Oscar,

I searched Hackster for photon web server projects, and found a couple that you might want to take a look (see below).
Of course they do not cover exactly your case of a personal website, but give you hints on how to configure a webhook to hit your personal website perhaps.

Post back if you have more questions!
Gustavo.

1 Like

Thanks for the reply, I will check the smart plant link that I had not seen. Unfortunately the second link does not help me, the same as the webhook documentation in particle docs, where thingspeak is used, since I need to use my own website.

Sadly, the smart plant link also uses thingspeak website, which does not guide me at all to configure my own website. I think Particle should give an example of how to use webhook to capture data on a personal website.

I would appreciate any help that someone can give me.

How could someone possibly make a tutorial about configuring a personal website if we don't know what that website looks like?

Have you got that server already? If so, what's the configuration? If not, then it's probably a good place to first look for an (external) tutorial on how to set one up.

The webhook tutorials that are provided can be applied to any website, you just need to change some parameters to match your setup.

Have a look at these though:

3 Likes

To add to @Moors7ā€™s statement.
If you want your website to support webhooks, youā€™d just need to create an endpoint where the cloud can POST and/or PUT your data (may it be as WebForm or JSON) and that endpoint will catch your data and do with it whatever it likes.

Alternatively there are some repos that show how to run a NodeJS server that can be fed data via the Particle cloud or local TCP and puts that data into a MySQL DB
locally

remote

1 Like

Hi there, since the variations are in the trillions here, it would be a monumental task, and some may say that amount of work can be dedicated to something else. But hey, here you are, missing that piece of information.

One thing is clear to me: the docs did not help me some time ago since I was not able to grasp all the knowledge they had for me. As they are not helping you either today. With time, with more reading, I was able to connect the dots in my mind (but still I have so many dots yet to be connected!!!). I hope you will be able to do that too.

So, one way out would be this:

How about you declare how you envision or think an external server can talk to your personal website and we all take it from there?
Only then one would be able to guess or think of a solution to your (very particular and only applies to you) problem.
In other words, if you were to post information from another of your servers to this personal website of yours, how would you do it? Please explain that, then we are half way to the solution.

Many people around here want to help, so give them something in order to get what you want :wink:
Cheers,
Gustavo.

4 Likes

I think my post was very clear if you read carefully. Iā€™m not asking how to create a website, that I have very clear since I have 38 years of experience especially in Linux. Iā€™m consulting the way to connect a photon, to a personal website (not thingspeak, etc.) In other words, an example of webhook and personal website connection.
Thank you for your answers.

I forgot to mention the HTTPClient library which also allows you to directly POST data to your website.
Or TlsTcpClient if you need HTTPS.

But for ...

... you need to ...

Once you have that and ...

( * how this endpoint looks)

3 Likes

Hola Oscar, Hi Oscar,
Are you saying that I don't know how to read a post?
Just kidding... we can play that game if we choose to. However, we like to play nice and try to be helpful, that is why we want (or I would like) you to think how your website can receive external data.
You'll unblock unexpected help from the community and fix your issue in no time.
So no, no exact examples of what you need now, but a lot of ears/eyes/hands to help you get it done.
Cheers!
Gustavo.

4 Likes

Here's an analogy for this situation:
you have been buying cars for 38 years. You walk in a car dealer and say: "hey, I want to buy a new car". The dealer will tell you "sure! we have plenty of cars, so what type of car would you like, any make, model, color you prefer?"

So here we are, wondering what kind of car you would want, just that we are not going to sell it to you, but give it away for free. Please, tell us what kind of car you want, manual, automatic, make, model, color, any detail that might help narrow down the search in our inventory.

For this, you may say: I have a rest API that the particle cloud can call with JSON in the http POST request body.

Cheers,
Gustavo.

9 Likes

Hello Oscar,
I bought 4 particle of the photon model, and my experience is with raspberry pi and arduino, so I am also new to this technology.
I have been looking for the same answers that you posted in this forum ( pretty clear to me ) , and I have not found any answers to help me.
If you are interested please contact me at my email to see if we can help each other find the best solution. I have also been advising for many years on the LInux operating system.
regards

Then please do enlighten us. I'm usually not one to brag about titles, but when two 'elites' and a 'champion' -each with years of experience with Particle- can't figure out what the question is, then I think it's going to be hard to give a concise answer.

What is a "personal website"?
Is it a simple HTML file you open locally in your browser?
Is it a LAMP server, or perhaps a Node.js server?
Is it self-hosted?
What are the access points (API) into it?
Do you want to push, or rather pull?
What kind of database are we talking about?
That's just to name a few...

It's not that we're unwilling to help, or don't read carefully, it's that we're lacking information to give a decent answer. Mind you, none of this is really Particle related. Particle provides various ways of talking to the outside world, all of which are documented. There are APIs available to push information out (SSE, webhooks), as well as ways to pull information (Variables, and functions), not even mentioning the UDP/TCP/HTTP and whatnot you can run on the devices themselves.

As mentioned before, there's no wrong way to go about this. The options are there, and it's up to you to decide what works best in your particular scenario. Examples that are there should be plenty to solve these problems. That said, they're not personalized instructions, and a bit of modifying might be required to adapt it to your personal particular use-case. The Thinkspeak tutorial can be applied to any website, even 'personal' ones, assuming it has proper 'hooks' to get into the site.
Again, creating a website and server back-end, is not something that's Particle related, but we can be persuaded to help even those with decades of experience. That is, if we're given the information needed to understand the question.

4 Likes

Hi Sebastian,

If you would be interested in making that discussion public and help other people in the future (or maybe today) with what you guys come up with, please feel free to have an open conversation in a (new or this one) topic in the forum.
That way everybody learns and people asking this question in the future have an answer from you guys.
thanks!
Gustavo.

5 Likes

You might want to check out our SIS project at:

This project has several web pages that use the Particle Javascipt library to read variables from a Photon/Electron and call functions on a Photon/Electron. Source code for the web pages and for the particle device firmware can be found here.

3 Likes

Thanks BobG for the link, i am going to check it.

Hello Gustavo,
Maybe it is important to restart this post in a fresh way. As I indicated in the title clearly, I am a newbie in this technology.
English is not my native language, so letā€™s assume that I do not express myself well and that caused misunderstandings. I think we all subscribe to this type of forum, trying to find help and not discussions that do not lead to anything.
So Iā€™m going to post my doubts again, and try to be as clear as possible:

1- I know there are several ways to send data from a photon to a webserver. (https, curl, webhook, etc.) Any of these is the most recommended? (security, speed, etc.) based on experience

2- There is any example of a webhook connection with a server ā€œof its ownā€ i mean my own server (does not matter if i install on it apache2, node js, nginx, etc., any example that does not use thingspeak, opensensors, etc. third-party servers)?

As Iā€™ve been reading and doing tests, especially with the mysql example that ScruffR ( thanks ) indicated,

3- Is it correct that the token is the same for all the devices added to my account? (I saw this when using curl by terminal)

Hello Sebastian thanks for your help!!

Thanks again.

1 Like

that's alright, mine either (Āæhablas espaƱol?)

If you want to push information from your Photon to your server, I think the recommended way is via webhooks. This is secure and the least effort for the reduced firepower of your device.

Another option: if the Photon resides in the same network as your own server, you may choose to use the tcp client. This way the information travels unencrypted, so use with care.

However, if you want to pull information from your webserver, you may choose to use the mechanism described in the SISProject, that is, javascript running on your server is sending http requests to the Particle cloud. Paired with cloud variables, this allows you to access information in your photon.

Yes, the Access Token is the same for all the devices you add to your account.

This is great, now we are getting to know what kind of car you like to drive :racing_car:
Thanks!

Post back with more questions if you have.
Gustavo.

2 Likes

Same here; Dutch, and studying in Germany. @ScruffR is from Austria, so we definitely have nothing against non-native English speakers :wink:

Again, it depends. If it's local, you can go for the TCP like @gusgonnet mentioned.
If it's client-sided, you can use the JS library with SSE's, or functions, or variables. Have a look at the topics I posted above.
If it's server based: as long as the server can make a REST API call, you should be fine to retrieve your variables/functions. If the server exposes API endpoints, you can access those with the HTTP client directly from the device or though webhooks.

How is a 3rd party server (example) any different from a server you'd host? For all the webhook cares, they're both 3rd party. But Webhooks use a REST API as well, so if your server can deal with that, you should be good to go. If you've got a server configuration in mind, let us know, so we can give more meaningful answers.

1 Like