Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temperature sensor #21

Open
protolyser opened this issue Oct 12, 2016 · 3 comments
Open

Temperature sensor #21

protolyser opened this issue Oct 12, 2016 · 3 comments

Comments

@protolyser
Copy link

Is there more documentation about how to use the nodes?
I want to use a tmp36 sensor with johnny five within node-red on raspberry pi with an attached arduino.
Which node should I use? GPIO node gives me input but I don't know how to use the johnny five stuff then. (https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-tmp36.md)

With the johnny five node I can't get it to work because I don't really understand how.
The led blink example works.

Can someone give me a hint?

@monteslu
Copy link
Owner

You can almost take the code directly from that example. You just need to pull out the code that happens inside of the ready event and put that in the johnny5 node:

  var temperature = new five.Thermometer({
    controller: "TMP36",
    pin: "A0"
  });

  temperature.on("change", function() {
    console.log(this.celsius + "°C", this.fahrenheit + "°F");
  });

If you want to have the data passed along in your flow, you can do something like this instead of just console logging:

  var temperature = new five.Thermometer({
    controller: "TMP36",
    pin: "A0"
  });

  temperature.on("change", function() {
    node.send({
       topic: 'temperature',
       celsius: this.celsius,
       fahrenheit: this.fahrenheit
    });
  });

@protolyser
Copy link
Author

always that easy if you know how.. Thanks a lot.
Now I have the problem that it puts out strange values. 55°C in reality here are 18°C. I set it up exactly like in the example.
Also it seems that the temperature sensor is influenced by a light sensor attached to A1.
Do you know how I can fix that? Or do know a adress where I can ask questions about that?

@monteslu
Copy link
Owner

This could be a bug, any chance you can try that example outside of node-red and with johnny-five directly and compare the values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants