Help novice with photon


#2

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?


#3

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.


#4

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.


#5

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.


#6

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.


#7

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:






#8

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


#9

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.


#10

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.


#11

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)


#12

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.


#13

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.


#14

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


#15

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.


#16

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.


#17

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.


#18

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.


#19

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.


#20

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.


#21

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.