Help novice with photon

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

Hello,
The server is not local so i need to send the photon (2) information through internet.
The software that I am going to use on the server: node js and mongodb as a database
That is the practical example that I am looking for, the configuration of the webhook and the api to carry out this process, with this configuration.
Thanks.

That. That's the exact information we needed approximately 20 posts ago :wink:

That's a bit out of the realm of this community I think. It doesn't really relate to Particle, and better assistance for setting that up can be found elsewhere. Not trying to push you away, but this part of the puzzle isn't within the general area of focus here, and expertise is less likely to be found here than on dedicated forums/tutorials. With that said, you're looking for a RESTful API that can preferably take JSON data as input (though the latter isn't as strict if you're programming the server side anyhow). There are quite a few good tutorials out there on setting up a server like that using Express for the routing.

That is something we can help with once you can tell us more about the endpoints you've set up as mentioned above :slight_smile:

2 Likes

You win, I’m just kidding… It’s funny, 20 post back I did not know I was going to choose node js and mongodb !!

that info you have it in almost all the links provided as examples.

Perhaps, one example you could find in the link posted by @ScruffR some posts ago:

Cheers,
Gustavo.

1 Like

Thanks Gustavo, I think it’s time to end this post, from my side. Thanks to everyone who took time to respond.

1 Like

I hope you don’t take the things said above as a sign of reluctance to help from our side.
It’s just that we see too many open questions to actually provide a conclusive answer to your request.

With the provided information we can only give pointers and hints or would need to come up with a fully working solution from start to finish, which either of us could come up with, but that might not be what you actually need/want, can’t be taken as a “best practice” implementation due to the multitude of equally good solutions and a request for a full fledged solution, most of us would see as contract work - after all, noone who answered in this thread so far works for Particle, we just donate our free time to the community.

3 Likes

Hi Oscar, I've found this link today in case you are interested in it.

Thanks

Thanks,
I am going to check it.

1 Like