Understanding a PWM signal on an oscilloscope

Thread Starter

s200bym

Joined Aug 9, 2017
82
OMG!! Guys, I don't know how to thank you enough. Both the ON and OFF signals work perfectly. I have just tested them with the valves and it does as it should.

One thing I don't understand is, why they bumped the signal up to 12v. I just tried it directly from the Arduino at 5v and it still worked.

You guys are amazing.

Mike.

C:
void setup() {
  // put your setup code here, to run once:
pinMode (1, OUTPUT);
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.write(0x56);
  Serial.write(0x31);
  Serial.write(0x0A);

  delay(2000);

  Serial.write(0x56);
  Serial.write(0x30);
  Serial.write(0x0A);

  delay(2000);

}
 
Last edited by a moderator:

Thread Starter

s200bym

Joined Aug 9, 2017
82
If anyone is interested? Here is the code for my project. Next project is to add geofencing and time-based events.

Mike.

C:
const int  buttonPin = 2;    // The pin that the pushbutton is attached to
const int valvepin = 1;      // The pin that the valves are attached to



// Variables will change:
int buttonState;         // Current state of the button
int lastButtonState;     // Previous state of the button
bool valveStatus;





void setup()
{
  Serial.begin(9600);          //  Setup serial
  // Initialize the button pin as a input with pullup, active low
  pinMode(buttonPin, INPUT_PULLUP);
  //Initialize button states
  buttonState = digitalRead(buttonPin);
  lastButtonState = buttonState;

  Serial.println("Exhaust Valves ");

}

void loop()
{
  // Read the pushbutton input pin:
  buttonState = digitalRead(buttonPin);

  // Compare the buttonState to its previous state
  if (buttonState != lastButtonState) //Changed
  {
    if (buttonState == LOW) //New press, so change servo flag
    {
      valveStatus = !valveStatus;
    }
    delay(50);
  }

  lastButtonState = buttonState; // Save the current state as the last state, for next time through the loop


  if (valveStatus) //Positions the valve
  {
    Serial.write(0x56);
    Serial.write(0x31);
    Serial.write(0x0A);
  
    Serial.print("Valve Status: ");
    Serial.print(" Valve Open");
    Serial.println(" (Loud Mode)");

    {


    }
  }    else
  {
    Serial.write(0x56);
    Serial.write(0x30);
    Serial.write(0x0A);

    Serial.print("Valve Status: ");
    Serial.print(" Valve Closed");
    Serial.println(" (Quiet Mode)");

  }
}
 
Last edited by a moderator:

Alec_t

Joined Sep 17, 2013
14,314
One thing I don't understand is, why they bumped the signal up to 12v.
Just a guess, but perhaps to combat any EMI pickup on the signal wire? Or it could be that the controller sends a 3V signal to switch an open collector/drain transistor which has a pull-up to the 12V supply.
 
Last edited:

Thread Starter

s200bym

Joined Aug 9, 2017
82
There are 2 separate valves controlled off of the same pin, then it's split into 2 separate circuits. Maybe it was easier to bump it up to 12v to keep a strong signal.
 
The real RS232C spec actually had levels from -3 to -25 and +3 to +25 V. In modern times, you seldom see more than +-12 V.
You can "sometimes" use RS422 signals to communicate with RS232 devices with some wiring changes. Old MAC's had no trouble communicating with modems. I did have one RS232 device that "required" an active RS422 to RS232 converter. The real R232 interface to Bell Telephone modems actually had 25 pins.
 

alecz2008

Joined Oct 17, 2019
3
Hi S200Bym !
Great project, so you've just connected one of the three valve pins to the arduino without pumping to 12 V ?
Could you please share the pins of the SBS actuator (12v,GND,Data ?), so which pin is what ?
How's your final hardware looking like ?? I'd appreciate any answer !!!!! Thanks
 

alecz2008

Joined Oct 17, 2019
3
Hi S200Bym,
looks like I am also stuck at a point where I can see a serial 12V signal with 20kbit , but how could I decode it ?
I have recorded the signal with a datalogger and put it into a CSV file.

Is there any software where I could get the real sequence to replicate and send it onto the bus ?

THX
Alex

OMG!! Guys, I don't know how to thank you enough. Both the ON and OFF signals work perfectly. I have just tested them with the valves and it does as it should.

One thing I don't understand is, why they bumped the signal up to 12v. I just tried it directly from the Arduino at 5v and it still worked.

You guys are amazing.

Mike.

C:
void setup() {
  // put your setup code here, to run once:
pinMode (1, OUTPUT);
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.write(0x56);
  Serial.write(0x31);
  Serial.write(0x0A);

  delay(2000);

  Serial.write(0x56);
  Serial.write(0x30);
  Serial.write(0x0A);

  delay(2000);

}
 
Top