Closed ff6347 closed 6 years ago
Thanks for providing such a thorough bug report <3
Writing Arduino firmware and analyzing the result.
I went ahead and did this, but not for an Arduino because there is no issue there. I wrote this:
#include "application.h"
SYSTEM_MODE(AUTOMATIC);
unsigned long lastms;
unsigned long nowms;
unsigned long sampleInterval = 100;
void setup() {
Serial.begin(115200);
pinMode(A0, INPUT);
}
void loop() {
nowms = millis();
if (nowms - lastms > sampleInterval) {
lastms += sampleInterval;
Serial.println(analogRead(A0));
}
}
Note: particle photon firmware is at 0.4.9, which I had to download manually to the particle-cli/updates
dir.
* I'm not sure how to resolve this discrepancy, there may be an obvious solution, eg adjusting the math used to determine a distance... but I don't want to rush into that.
w/r to this:
I can run the attached code once and I get a reading that is slightly of but reacts to objects coming in range. Slightly of means the distance is a bit lower as the proximity module logs but it is consistent in its values. When stopping the program (by hitting CTRL+C twice) and rerunning it again. I get way to high values for the first seconds and then the value comes down and stays in a certain range without reacting to any thing coming in its range.
I could not reproduce the spike in readings (using the matte-white obstruction at 15cm—unmoved.)
Adding the capacitor for smoothing the result. Works with and without.
Confirmed.
Running the sensor from the boards 3.3V. Does not work.
Confirmed.
Exchange the board. Gives the same results.
Confirmed (with an alternate Photon)
Adding a diode on the analog input of the board. Works with and without.
Did not attempt
Adding a voltage divider for lowering the voltage reaching the board. Works with and without.
Confirmed.
Running the sensor from a different power source then the board. Does not work.
Did not attempt
Setting the debug mode of the voodoo spark firmware to true. VS reports the analog values and they behave the same as the values logged by the node program. Running it without the Proximity module Just as analog pin. Same result. particle-io directly not as a johnny-five plugin. same result.
Confirmed all.
I will continue working on this a bit later, I have to change gears for the rest of the day.
Another workaround. When we register another Sharp sensor on another pin without adding anything to it, the readings are working after a restart of the program. We don't use it we just have it in our code. 🤔
var proximity2 = new five.Proximity({
controller: "GP2Y0A02YK0F",
pin: "A2"
});
I'm not able to reproduce the issue where no readings are delivered, but the voltage divider changes the math and invalidates the formula being used. I'm still trying to figure out how to make so that's not an impediment, whether it's customizable or not, I'm not sure yet...
I'm not able to reproduce the issue where no readings are delivered
What do you mean by that?
About the voltage divider. Yes I know it renders the calculated output useless. Maybe the Proximity module can have a option to provide a own formula.
Did you try to just add another proximity object? It is pretty wired that just adding another object in the code makes the sensor reading work again.
Did you try to just add another proximity object?
I will try this.
It is pretty weird that just adding another object in the code makes the sensor reading work again.
I've seen before in the Intel Galileo and Galileo 2 :\
Can you supply the voltage of the 10uf capacitor and the specs on the diode please.
Kindest regards, Grant Fitz
hi @fitzgr the project was finished a year ago and is already dismantled. Sorry
Can you supply the voltage of the 10uf capacitor and the specs on the diode please.
Kindest regards, Grant Fitz
Woops sorry for the repost.
It sounds like we should close the issue since @fabianmoronzirfas has dismantled the project. Anyone feel free to re-open if there is a way we can make progress.
Board: Particle Photon Shield: none Hardware: Sharp GP2Y0A02YK0F distance sensor Johnny-Five Version: 0.9.17 Node version: 0.12.9 OS: OSX 10.11.3 Expected result: same result after rerunning the program Current result: Values in first run are okay. sensor does not react to objects in second run Steps to reproduce: See the code and a fritzing sketch below video: https://vimeo.com/153079052
Hi. We already discussed this problem in the gitter chat. I'll add an issue here to have it persistent. When having a hardware setup like shown in the image, I get the following problem.
I can run the attached code once and I get a reading that is slightly of but reacts to objects coming in range. Slightly of means the distance is a bit lower as the proximity module logs but it is consistent in its values. When stopping the program (by hitting CTRL+C twice) and rerunning it again. I get way to high values for the first seconds and then the value comes down and stays in a certain range without reacting to any thing coming in its range.
When I restart the Photon board by pulling he RST pin low or unplugging the external power supply the reading is again as expected.
I already tried:
ToDos:
Workaround:
My current workaround is to add the pushbutton connected to the ground and just restart the board after killing the node program by pushing it once.
Links:
Code:
index.js
package.json
particle-io-bare-minimum.js
config/default.json
A file for storing the config data. Create it as config/defaul.json
circuit: