KS0529 Keyestudio DMX(RDM)Shield: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
(Created blank page)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:


== Description ==
This DMX(RDM) shield is designed for Arduino. Its working voltage is 5V and has 0.5W power consumption.<br>
It can transmit and receive DMX through Arduino so as to control speakers, light and smoke machine. If you get tired of the programming language, you also can use C language with the DMX(RDM)shield.<br>
<br>[[File:0529-1.png|500px|frameless|thumb]]<br> 
'''Working Principle'''
DMX(RDM)shield communicates via DMX. It can serve as the Master or Slave when you treat Ardunio as the controller of DMX. DMX shield is an add-on for the Arduino and the MAX485 chip can drive the circuit.
DMX library is based on the USART library, which indicates TX and RX serial communication are applied. When the port of Arduino is connected to MAX485, the DMX device can communicate with Arduino.
<br>[[File:0529-2.png|500px|frameless|thumb]]<br> 
MAX485 Chip Schematic Diagram
<br>[[File:0529-3.png|500px|frameless|thumb]]<br> 
DMX(RDM)Shield Schematic Diagram
'''Connection Diagram'''
<br>[[File:0529-4.png|500px|frameless|thumb]]<br> 
Test Result
Prepare two Arduino control boards and two DMX shields and a three-hole connection wire.
Code:Max485_Master.ino and Max485_Slave.ino
Insert this shield onto the Arduino board which has programmed the test code Max485_Master.ino
Then insert the another shield onto another Arduino board which has programmed the test code Max485_Slave.ino
<br>[[File:0529-5.png|500px|frameless|thumb]]<br> 
Then open the monitor of Arduino, you will view numbers become from larger to smaller then larger.
<br>[[File:0529-6.png|500px|frameless|thumb]]<br> 
Arduino serial monitor
Test Code 1:
<pre>
Max485_Master.ino
int enablePin = 2; 
int brightness = 0;    //define the variable brightness and its initial value, which is used to indicate the LED brightness
int fadeAmount = 5;    //define the variable fade Amount which is used to indicate the decrement
int Pwm_pin = 9;
void setup()
{
  Serial.begin(9600);            // initialize serial at baud rate 9600:
  pinMode(enablePin, OUTPUT);
  pinMode(Pwm_pin,OUTPUT);
  delay(10);
  digitalWrite(enablePin, HIGH);  //  (always high as Master Writes data to Slave)
}
void loop()
{
  analogWrite(Pwm_pin, brightness);//write the value of brightness to the port 9
  brightness = brightness + fadeAmount;//change the value of brightness to alter in the next circulation
  Serial.println(brightness);
  if (brightness == 0 || brightness == 255)
  {
    fadeAmount = -fadeAmount ; //
  }   
 
  delay(30); //delay in 30ms
}
</pre>
Test Code 2:
<pre>
Max485_Slave.ino
int enablePin = 2;
int ledpin = 13;
void setup()
{
  Serial.begin(9600);                  // initialize serial at baud rate 9600:
  pinMode(ledpin,OUTPUT);
  pinMode(enablePin, OUTPUT);
  delay(10);
  digitalWrite(enablePin, LOW);        //  (Pin 8 always LOW to receive value from Master)
 
}
void loop()
{                                                 
  while (Serial.available())                  //While have data at Serial port this loop executes
  {         
    int pwmval = Serial.parseInt();            //Receive INTEGER value from Master throught RS-485
    int convert = map(pwmval,0,1023,0,255);    //Map those value from (0-1023) to (0-255)
    analogWrite(ledpin,convert);              //PWM write to LED                        //Displays the PWM value
    Serial.println(pwmval);
    delay(30);
    }
}
</pre>
== Test Result ==
Prepare two Arduino control boards and two DMX shields and a three-hole connection wire.
Code:Max485_Master.ino and Max485_Slave.ino
Insert this shield onto the Arduino board which has programmed the test code Max485_Master.ino
Then insert the another shield onto another Arduino board which has programmed the test code Max485_Slave.ino
Then open the monitor of Arduino, you will view numbers become from larger to smaller then larger.
Test Code 1:
<pre>
Max485_Master.ino
int enablePin = 2; 
int brightness = 0;    //define the variable brightness and its initial value, which is used to indicate the LED brightness
int fadeAmount = 5;    //define the variable fade Amount which is used to indicate the decrement
int Pwm_pin = 9;
void setup()
{
  Serial.begin(9600);            // initialize serial at baud rate 9600:
  pinMode(enablePin, OUTPUT);
  pinMode(Pwm_pin,OUTPUT);
  delay(10);
  digitalWrite(enablePin, HIGH);  //  (always high as Master Writes data to Slave)
}
void loop()
{
  analogWrite(Pwm_pin, brightness);//write the value of brightness to the port 9
  brightness = brightness + fadeAmount;//change the value of brightness to alter in the next circulation
  Serial.println(brightness);
  if (brightness == 0 || brightness == 255)
  {
    fadeAmount = -fadeAmount ; //
  }   
 
  delay(30); //delay in 30ms
}
</pre>
Test Code 2:
<pre>
Max485_Slave.ino
int enablePin = 2;
int ledpin = 13;
void setup()
{
  Serial.begin(9600);                  // initialize serial at baudrate 9600:
  pinMode(ledpin,OUTPUT);
  pinMode(enablePin, OUTPUT);
  delay(10);
  digitalWrite(enablePin, LOW);        //  (Pin 8 always LOW to receive value from Master)
 
}
void loop()
{                                                 
  while (Serial.available())                  //While have data at Serial port this loop executes
  {         
    int pwmval = Serial.parseInt();            //Receive INTEGER value from Master throught RS-485
    int convert = map(pwmval,0,1023,0,255);    //Map those value from (0-1023) to (0-255)
    analogWrite(ledpin,convert);              //PWM write to LED                        //Displays the PWM value
    Serial.println(pwmval);
    delay(30);
    }
}
</pre>
== Resource ==
For more details, click the following link:
https://fs.keyestudio.com/KS0529

Latest revision as of 14:52, 10 December 2021


Description

This DMX(RDM) shield is designed for Arduino. Its working voltage is 5V and has 0.5W power consumption.
It can transmit and receive DMX through Arduino so as to control speakers, light and smoke machine. If you get tired of the programming language, you also can use C language with the DMX(RDM)shield.


thumb

Working Principle

DMX(RDM)shield communicates via DMX. It can serve as the Master or Slave when you treat Ardunio as the controller of DMX. DMX shield is an add-on for the Arduino and the MAX485 chip can drive the circuit. DMX library is based on the USART library, which indicates TX and RX serial communication are applied. When the port of Arduino is connected to MAX485, the DMX device can communicate with Arduino.


thumb

MAX485 Chip Schematic Diagram


thumb
DMX(RDM)Shield Schematic Diagram


Connection Diagram


thumb


Test Result Prepare two Arduino control boards and two DMX shields and a three-hole connection wire. Code:Max485_Master.ino and Max485_Slave.ino

Insert this shield onto the Arduino board which has programmed the test code Max485_Master.ino Then insert the another shield onto another Arduino board which has programmed the test code Max485_Slave.ino


thumb

Then open the monitor of Arduino, you will view numbers become from larger to smaller then larger.


thumb


Arduino serial monitor

Test Code 1:

Max485_Master.ino

int enablePin = 2;  
int brightness = 0;    //define the variable brightness and its initial value, which is used to indicate the LED brightness
int fadeAmount = 5;    //define the variable fade Amount which is used to indicate the decrement
int Pwm_pin = 9;
void setup()
{
  Serial.begin(9600);            // initialize serial at baud rate 9600:
  pinMode(enablePin, OUTPUT);
  pinMode(Pwm_pin,OUTPUT); 
  delay(10); 
  digitalWrite(enablePin, HIGH);  //  (always high as Master Writes data to Slave)
}

void loop()
{
  analogWrite(Pwm_pin, brightness);//write the value of brightness to the port 9
  brightness = brightness + fadeAmount;//change the value of brightness to alter in the next circulation
  Serial.println(brightness); 
  if (brightness == 0 || brightness == 255) 
  {
    fadeAmount = -fadeAmount ; //
  }     
  
  delay(30); //delay in 30ms
}

Test Code 2:

Max485_Slave.ino

int enablePin = 2; 
int ledpin = 13;

void setup() 
{
  Serial.begin(9600);                   // initialize serial at baud rate 9600:
  pinMode(ledpin,OUTPUT);
  pinMode(enablePin, OUTPUT);
  delay(10);
  digitalWrite(enablePin, LOW);        //  (Pin 8 always LOW to receive value from Master)
  
}

void loop() 
{                                                  
  while (Serial.available())                   //While have data at Serial port this loop executes
  {           
     int pwmval = Serial.parseInt();            //Receive INTEGER value from Master throught RS-485
     int convert = map(pwmval,0,1023,0,255);    //Map those value from (0-1023) to (0-255)
     analogWrite(ledpin,convert);               //PWM write to LED                        //Displays the PWM value
     Serial.println(pwmval);
     delay(30);
    }
}

Test Result

Prepare two Arduino control boards and two DMX shields and a three-hole connection wire. Code:Max485_Master.ino and Max485_Slave.ino

Insert this shield onto the Arduino board which has programmed the test code Max485_Master.ino Then insert the another shield onto another Arduino board which has programmed the test code Max485_Slave.ino



Then open the monitor of Arduino, you will view numbers become from larger to smaller then larger.


Test Code 1:


Max485_Master.ino

int enablePin = 2;  
int brightness = 0;    //define the variable brightness and its initial value, which is used to indicate the LED brightness
int fadeAmount = 5;    //define the variable fade Amount which is used to indicate the decrement
int Pwm_pin = 9;
void setup()
{
  Serial.begin(9600);            // initialize serial at baud rate 9600:
  pinMode(enablePin, OUTPUT);
  pinMode(Pwm_pin,OUTPUT); 
  delay(10); 
  digitalWrite(enablePin, HIGH);  //  (always high as Master Writes data to Slave)
}

void loop()
{
  analogWrite(Pwm_pin, brightness);//write the value of brightness to the port 9
  brightness = brightness + fadeAmount;//change the value of brightness to alter in the next circulation
  Serial.println(brightness); 
  if (brightness == 0 || brightness == 255) 
  {
    fadeAmount = -fadeAmount ; //
  }     
  
  delay(30); //delay in 30ms
}

Test Code 2:

Max485_Slave.ino

int enablePin = 2; 
int ledpin = 13;

void setup() 
{
  Serial.begin(9600);                   // initialize serial at baudrate 9600:
  pinMode(ledpin,OUTPUT);
  pinMode(enablePin, OUTPUT);
  delay(10);
  digitalWrite(enablePin, LOW);        //  (Pin 8 always LOW to receive value from Master)
  
}

void loop() 
{                                                  
  while (Serial.available())                   //While have data at Serial port this loop executes
  {           
     int pwmval = Serial.parseInt();            //Receive INTEGER value from Master throught RS-485
     int convert = map(pwmval,0,1023,0,255);    //Map those value from (0-1023) to (0-255)
     analogWrite(ledpin,convert);               //PWM write to LED                        //Displays the PWM value
     Serial.println(pwmval);
     delay(30);
    }
}


Resource

For more details, click the following link:

https://fs.keyestudio.com/KS0529