Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero. (why this is happening, and how to fix it)

The reason I am connecting the ground since I need measure other signals on that board. (All other signals are responding fine)

schematic

simulate this circuit – Schematic created using CircuitLab

code:

 #define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); } 
#define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); } 

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero. (why this is happening, and how to fix it)

The reason I am connecting the ground since I need measure other signals on that board. (All other signals are responding fine)

schematic

simulate this circuit – Schematic created using CircuitLab

code:

 #define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); } 

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero. (why this is happening, and how to fix it)

The reason I am connecting the ground since I need measure other signals on that board. (All other signals are responding fine)

schematic

simulate this circuit – Schematic created using CircuitLab

code:

#define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); } 
added 43 characters in body
Source Link
Shahreza
  • 165
  • 2
  • 11

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero. (why this is happening, and how to fix it)

The reason I am connecting the ground since I need measure other signals on that board. (All other signals are responding fine)

schematic

simulate this circuit – Schematic created using CircuitLab

code:

 #define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); } 

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero.

The reason I am connecting the ground since I need measure other signals on that board. (All other signals are responding fine)

schematic

simulate this circuit – Schematic created using CircuitLab

code:

 #define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); } 

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero. (why this is happening, and how to fix it)

The reason I am connecting the ground since I need measure other signals on that board. (All other signals are responding fine)

schematic

simulate this circuit – Schematic created using CircuitLab

code:

 #define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); } 
Source Link
Shahreza
  • 165
  • 2
  • 11

Pulsein not working when share ground

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero.

The reason I am connecting the ground since I need measure other signals on that board. (All other signals are responding fine)

schematic

simulate this circuit – Schematic created using CircuitLab

code:

 #define pulse_ip 3 unsigned long duration; int ontime,offtime,duty; float freq,period; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(pulse_ip, INPUT); } void loop() { // put your main code here, to run repeatedly: ontime = pulseIn(pulse_ip, HIGH); offtime = pulseIn(pulse_ip, LOW); period = ontime + offtime; freq = 1000000.0 / period; duty = (ontime / period) * 100; Serial.print(offtime); Serial.print("-"); Serial.print(ontime); Serial.print("-"); Serial.print(period); Serial.print("-"); Serial.print(freq); Serial.print("-"); Serial.print((duty * 255) / 100); Serial.print("-"); Serial.println(duty); delay(1000); }