DYNAMENT AN0007 Arduino ਤੋਂ ਪਲੈਟੀਨਮ COMM ਯੂਜ਼ਰ ਗਾਈਡ

AN0007 Arduino ਤੋਂ ਪਲੈਟੀਨਮ COMM

ਉਤਪਾਦ ਜਾਣਕਾਰੀ

ਨਿਰਧਾਰਨ

  • ਉਤਪਾਦ ਦਾ ਨਾਮ: ਆਰਡੁਇਨੋ ਤੋਂ ਪਲੈਟੀਨਮ ਕਾਮਸ ਮਦਦ ਦਸਤਾਵੇਜ਼
  • ਨਿਰਮਾਤਾ: ਡਾਇਨਾਮੇਂਟ ਲਿਮਿਟੇਡ
  • ਪਤਾ: ਹਰਮੀtage Lane Industrial Estate, Kings Mill Way,
    Mansfield, Nottinghamshire, NG18 5ER, UK
  • Contact: Tel: 44 (0)1623 663636, Email: sales@dynament.com,
    Website: www.dynament.com
  • ਅੰਕ: 1.2, ਮਿਤੀ: 09/04/2025

ਉਤਪਾਦ ਵਰਤੋਂ ਨਿਰਦੇਸ਼

ਸੈਂਸਰ ਨਾਲ ਜੁੜ ਰਿਹਾ ਹੈ

ਇਹ ਡੇਟਾ ਸ਼ੀਟ ਅਰਡੂਇਨੋ ਮੈਗਾ ਨੂੰ ਇੱਕ ਸਾਬਕਾ ਵਜੋਂ ਵਰਤਦੀ ਹੈample. Connect as
ਇਸ ਤਰ੍ਹਾਂ ਹੈ:

  • 5v -> 5v ਅਰਡਿਨੋ ਪਿੰਨ
  • 0v -> ਅਰਦੂਨੋ GND
  • Tx -> Arduino RX1
  • Rx -> Goes to the output of the potential divider. The input
    goes to Arduino Tx

ਵੋਲtage ਅਨੁਕੂਲਤਾ

The Arduino uses 5v logic high while the Platinum Sensor uses
3.3v. Use a voltage divider with suggested values for R1 and R2 as
4K7 to prevent damage to the Sensor.

Arduino IDE ਸੈੱਟਅੱਪ

  1. Download the newest version of the Arduino IDE software from
    the Arduino webਸਾਈਟ.
  2. Select the Arduino board, processor, and port in the tools
    ਡ੍ਰੌਪ-ਡਾਉਨ ਮੇਨੂ.

ਕੋਡ ਅਪਲੋਡ

  1. ਦਿੱਤੇ ਗਏ ਐਕਸ ਨੂੰ ਕਾਪੀ ਕਰੋampArduino IDE ਵਿੱਚ ਕੋਡ।
  2. ਤੀਰ 'ਤੇ ਕਲਿੱਕ ਕਰਕੇ ਕੋਡ ਨੂੰ Arduino 'ਤੇ ਅਪਲੋਡ ਕਰੋ।
  3. ਸੀਰੀਅਲ ਮਾਨੀਟਰ ਨੂੰ ਇਸ ਲਈ ਖੋਲ੍ਹੋ view ਡਾਟਾ ਸੰਚਾਰ.

FAQ

Q: What should I do if I have an Arduino Uno with only one comm
ਪੋਰਟ?

A: Connect the Platinum Sensor to that port. When using the
serial monitor, it will also show the transmitted hex.

"`

ਐਪਲੀਕੇਸ਼ਨ ਨੋਟ AN0007
ARDUINO to PLATINUM COMMS HELP DOCUMENT

ਡਾਇਨਾਮੇਂਟ ਲਿਮਿਟੇਡ
ਹਰਮੀtagਈ ਲੇਨ ਇੰਡਸਟਰੀਅਲ ਅਸਟੇਟ ਕਿੰਗਜ਼ ਮਿੱਲ ਵੇ ਮੈਨਸਫੀਲਡ ਨੌਟਿੰਘਮਸ਼ਾਇਰ NG18 5ER ਯੂਕੇ। ਟੈਲੀਫ਼ੋਨ: 44 (0)1623 663636
email: sales@dynament.com www.dynament.com

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 1 ਵਿੱਚੋਂ 14

ਸਮੱਗਰੀ
Dynament Limited …………………………………………………………………………………………………….1 Connecting the Sensor……………………………………………………………………………………………..3 Arduino IDE ………………………………………………………………………………………………………………5 Code Explanation……………………………………………………………………………………………………..9 Packet Breakdown ………………………………………………………………………………………………….11 Using Serial.read() ………………………………………………………………………………………………….13
Advanced Conversion Notes……………………………………………………………………………….14

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 2 ਵਿੱਚੋਂ 14

Connecting the Sensor This data sheet uses the Arduino Mega as an example. Ardunio Mega ਇੱਕ ਤੋਂ ਵੱਧ ਕਮਿਊਨਿਟੀ ਪੋਰਟ ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ, ਇਸ ਲਈ ਕਮਿਊਨਿਟੀ ਪੋਰਟ 1 ਸੈਂਸਰ ਨਾਲ ਸੰਚਾਰ ਕਰਨ ਲਈ ਵਰਤਿਆ ਜਾਂਦਾ ਹੈ ਅਤੇ ਕਮਿਊਨਿਟੀ ਪੋਰਟ 0 ਪੀਸੀ ਤੇ ਪ੍ਰਿੰਟ ਕਰਨ ਲਈ ਵਰਤਿਆ ਜਾਂਦਾ ਹੈ।
Arduino 5v ਲਾਜਿਕ ਹਾਈ ਦੀ ਵਰਤੋਂ ਕਰਦਾ ਹੈ ਜਦੋਂ ਕਿ ਪਲੈਟੀਨਮ ਸੈਂਸਰ 3.3v ਦੀ ਵਰਤੋਂ ਕਰਦਾ ਹੈ, ਇਸ ਲਈ ਸੈਂਸਰ ਨੂੰ ਨੁਕਸਾਨ ਤੋਂ ਬਚਾਉਣ ਲਈ ਇੱਕ ਵੋਲਯੂਮtage divider must be used. Suggested values for R1 and R2 are 4K7.

Figure 1: Lowers the voltage to useable level
The Sensor transmit line going to the Arduino receive doesn’t need a divider as 3.3v is an acceptable input to the Arduino.
In order to power the Sensor it must be connected to 5v and 0v. To do this you can use the pins on the Arduino.
After this is complete, the sensor should now have the following pins connected:
5v -> 5v ਅਰਡਿਨੋ ਪਿੰਨ
0v -> ਅਰਦੂਨੋ GND
Tx -> Arduino RX1
Rx -> Goes to the output of the potential divider. The input goes to Arduino Tx

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 3 ਵਿੱਚੋਂ 14

After this is complete your Platinum Sensor should be connected as shown:
Figure 2: Sensor is shown upside down with a solder adapter
ਜੇਕਰ ਤੁਸੀਂ ਸਿਰਫ਼ ਇੱਕ ਕਮਿਊਨੀਕੇਸ਼ਨ ਪੋਰਟ (ਜਿਵੇਂ ਕਿ Arduino Uno) ਵਾਲਾ Arduino ਵਰਤ ਰਹੇ ਹੋ ਤਾਂ ਤੁਹਾਨੂੰ ਇਸਨੂੰ ਉਸ ਨਾਲ ਜੋੜਨਾ ਪਵੇਗਾ, ਹਾਲਾਂਕਿ ਜਦੋਂ ਤੁਸੀਂ ਸੀਰੀਅਲ ਮਾਨੀਟਰ (ਬਾਅਦ ਵਿੱਚ ਦਿਖਾਇਆ ਗਿਆ) ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹੋ ਤਾਂ ਇਹ ਪ੍ਰਸਾਰਿਤ ਹੋਣ ਵਾਲਾ ਹੈਕਸ ਵੀ ਦਿਖਾਏਗਾ।

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 4 ਵਿੱਚੋਂ 14

Arduino IDE Go to the Arduino website and download the newest version of the Arduino IDE software. Once installed you should see the following screen:
Figure 3: Arduino home screen
In the tools drop down menu select the Arduino board, processor and port you are using:

Figure 4: Select Board, Processor and Port options

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 5 ਵਿੱਚੋਂ 14

ਇਸ ਸਾਬਕਾ ਵਿੱਚ ਕਾਪੀ ਕਰੋample code: void send_read_live_data_simple(); void receive_read_live_data_simple();
void setup() { Serial.begin(38400); Serial1.begin(38400);
}
void loop() { send_read_live_data_simple(); receive_read_live_data_simple(); delay(5000);
}
void send_read_live_data_simple(){ // 0x10, 0x13, 0x06, 0x10, 0x1F, 0x00, 0x58 Serial1.write(0x10); Serial1.write(0x13); Serial1.write(0x06); Serial1.write(0x10); Serial1.write(0x1F); Serial1.write(0x00); Serial1.write(0x58);
}
void receive_read_live_data_simple(){ while (Serial1.available()) { Serial.print(Serial1.read(), HEX); Serial.print(“|”); } Serial.println();
}

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 6 ਵਿੱਚੋਂ 14

Figure 5: Code ready to upload
Click the arrow to upload the code to the Arduino. After the Arduino has been programmed open the serial monitor.

AN0007

Figure 6: Open the Serial Monitor

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 7 ਵਿੱਚੋਂ 14

Figure 7: The Serial Montor shows the packet that has been received

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 8 ਵਿੱਚੋਂ 14

Code Explanation The Arduino IDE uses C++ to program the Arduino.
This line is a forward declaration. This is used to tell the Microcontroller that further down in the program the `send_read_live_data_simple’ function and the `receive_read_live_data_simple’ function will be called.
ਅੱਗੇ ਸੈੱਟਅੱਪ ਫੰਕਸ਼ਨ ਹੈ। ਇਹ ਕੋਡ ਸਟਾਰਟਅੱਪ 'ਤੇ ਸਿਰਫ਼ ਇੱਕ ਵਾਰ ਚਲਾਇਆ ਜਾਂਦਾ ਹੈ। ਇਹ Serial0 ਅਤੇ Serial1 ਪੋਰਟਾਂ ਨੂੰ ਸ਼ੁਰੂ ਕਰਦਾ ਹੈ। Serial0 ਉਹ ਹੈ ਜੋ ਸੀਰੀਅਲ ਮਾਨੀਟਰ ਸਕ੍ਰੀਨ ਵਿੱਚ ਦਿਖਾਇਆ ਗਿਆ ਹੈ। Serial1 ਸੈਂਸਰ ਨਾਲ ਸੰਚਾਰ ਕਰਨ ਲਈ ਪੋਰਟ ਹੈ।
This is the main loop, this code gets repeatedly looped. You can see by reading the function names that it sends a request to read a simplified version of the live data struct. Then it reads the receive port to read the reply. After this the Microcontroller waits 5000mS.
This function writes the request to get the live data simple struct to serial port 1. As previously mentioned if you only have one serial port you should change Serial1 to Serial. To see the full list of commands, refer to the Premier sensor Communications protocol document. Here is the part of the document that tells you what to write for this command:

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 9 ਵਿੱਚੋਂ 14

This function loops the read function while there is still data to be received from the Platinum Sensor. Serial1.read() reads the data from Serial1 which is connected to the sensor and prints it on Serial0 so it can be seen on the serial monitor. The character `|’ is then printed to break up each byte that is received to make it clearer on the serial monitor.
After this is complete it writes a new line to the serial monitor.

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 10 ਵਿੱਚੋਂ 14

Packet Breakdown Figure 8 and 9 show the output of a serial decoder connected to the receive and transmit lines.
Figure 8: Outgoing Packet
Figure 9: Incoming Packet
ਚਿੱਤਰ 10 ਅਤੇ 11 ਕ੍ਰਮਵਾਰ ਆਊਟਗੋਇੰਗ ਅਤੇ ਇਨਕਮਿੰਗ ਹੈਕਸ ਨੂੰ ਇੱਕ ਕਾਲਮ ਨਾਲ ਦਿਖਾਉਂਦੇ ਹਨ ਜੋ ਦਰਸਾਉਂਦਾ ਹੈ ਕਿ ਇਹ ਕਿਹੜਾ ਕਮਾਂਡ ਹੈ।

Figure 10: Outgoing Packet Description

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 11 ਵਿੱਚੋਂ 14

Figure 11: Incoming Packet Description
ਕਿਰਪਾ ਕਰਕੇ ਧਿਆਨ ਦਿਓ ਕਿ ਗੈਸ ਰੀਡਿੰਗ ਇੱਕ ਦਸ਼ਮਲਵ ਹੈ, ਇੱਕ ਪੂਰਨ ਅੰਕ ਨਹੀਂ। ਇਹ ਦਸ਼ਮਲਵ IEEE-754 ਫਾਰਮੈਟ ਵਿੱਚ ਹੈ, ਤੁਸੀਂ ਇਸਨੂੰ ਬਦਲਣ ਲਈ ਇਸ ਤਰ੍ਹਾਂ ਦੇ ਔਨਲਾਈਨ ਕਨਵਰਟਰ ਦੀ ਵਰਤੋਂ ਕਰ ਸਕਦੇ ਹੋ। ਇਸ ਮਾਮਲੇ ਵਿੱਚ ਗੈਸ ਮੁੱਲ -250 ਦਰਸਾਉਂਦਾ ਹੈ (ਜਿਵੇਂ ਕਿ ਇਹ ਉਸ ਸਮੇਂ ਗਲਤੀ ਮੋਡ ਵਿੱਚ ਸੀ)।

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 12 ਵਿੱਚੋਂ 14

Serial.read() ਦੀ ਵਰਤੋਂ ਕਰਨਾ
The previous code only printed the data received to the serial monitor, if you want to save the data in variables you will need to do some further processing. The packet you receive is split into bytes, because of this you will need to concatenate some of this data into variables. Serial1.Read() returns an int (which for Arduino is 16 bits), however, only the first 8 bits are used. Because of this we can copy it into a smaller data type that is only 8 bits, in this case I will use char.
for the packets that are only a byte long, this works fine:
For the packets that are 2 bytes or 4 bytes long you will need to concatenate the data.

ਤੁਸੀਂ ਇਹ ਬਹੁਤ ਸਾਰੇ ਵੱਖ-ਵੱਖ ਤਰੀਕਿਆਂ ਨਾਲ ਕਰ ਸਕਦੇ ਹੋ, ਇੱਥੇ ਮੈਂ ਡੇਟਾ ਨੂੰ ਖੱਬੇ ਪਾਸੇ ਸ਼ਿਫਟ ਕਰਨ ਜਾ ਰਿਹਾ ਹਾਂ ਅਤੇ ਫਿਰ ਇਸਨੂੰ OR ਕਰਨ ਜਾ ਰਿਹਾ ਹਾਂ।

ਇਸ ਕੋਡ ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹੋਏ, ਜੇਕਰ readByte1 0x34 ਹੈ ਅਤੇ readByte2 0x12 ਹੈ।

(int)readByte2

// this converts the 0x12 into 0x0012.

(int)readByte2 << 8

// this shifts the bits over by a byte making it 0x1200.

(int)readByte2 << 8 | readByte1 // ਇਹ ਫਿਰ OR'ed ਹੋ ਜਾਂਦਾ ਹੈ, 0x34 ਨਾਲ 0x1234 ਬਣਦਾ ਹੈ।

ਅਜਿਹਾ ਕਰਨ ਦਾ ਇੱਕ ਹੋਰ ਤਰੀਕਾ ਇਹ ਹੋਵੇਗਾ ਕਿ ਮੁੱਲਾਂ ਨੂੰ ਇੱਕ ਐਰੇ ਵਿੱਚ ਪਾਓ ਅਤੇ ਫਿਰ ਐਰੇ ਨੂੰ ਉਸ ਕਿਸਮ ਵਿੱਚ ਬਦਲੋ ਜਿਸਦੀ ਤੁਸੀਂ ਚਾਹੁੰਦੇ ਹੋ:

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 13 ਵਿੱਚੋਂ 14

chars are a byte long, whereas float is 4 bytes long. Because of this if we make an array of 4 chars with our values in it and change the type to float.
ਇਸ ਮਾਮਲੇ ਵਿੱਚ readArray ਇੱਕ char ਐਰੇ ਲਈ ਇੱਕ ਪੁਆਇੰਟਰ ਹੈ। (float*)readArray ਇਹ ਹਿੱਸਾ ਇਸਨੂੰ ਇੱਕ ਫਲੋਟ ਦੇ ਪੁਆਇੰਟਰ ਤੇ ਕਾਸਟ ਕਰਦਾ ਹੈ ਅਤੇ ਫਿਰ ਫਲੋਟ ਦਾ ਮੁੱਲ ਪ੍ਰਾਪਤ ਕਰਨ ਲਈ ਸਾਹਮਣੇ ਇੱਕ * ਜੋੜਿਆ ਜਾਂਦਾ ਹੈ।
ਉੱਨਤ ਪਰਿਵਰਤਨ ਨੋਟਸ
1. Serial.read() returns int instead of char because errors will return negative values. Your program should check for this.
2. uint8_t and uint16_t should be used in place of char and int respectively, as these types do not have a standard size (on my PC int is 32 bits whereas on the Arduino it is 16 bits).
3. The comms protocol contains byte stuffed characters (also known as control characters), this is explained in more detail in the tds0045 Premier sensor Communications protocol document. Because of this the read live data simple packet will occasionally be bigger than expected.

AN0007

ਮੁੱਦਾ 1.2

09/04/2025

Change Note 805

ਪੰਨਾ 14 ਵਿੱਚੋਂ 14

ਦਸਤਾਵੇਜ਼ / ਸਰੋਤ

DYNAMENT AN0007 Arduino ਤੋਂ ਪਲੈਟੀਨਮ COMM [pdf] ਯੂਜ਼ਰ ਗਾਈਡ
AN0007 Arduino to Platinum COMM, AN0007, Arduino to Platinum COMM, to Platinum COMM, Platinum COMM

ਹਵਾਲੇ

ਇੱਕ ਟਿੱਪਣੀ ਛੱਡੋ

ਤੁਹਾਡਾ ਈਮੇਲ ਪਤਾ ਪ੍ਰਕਾਸ਼ਿਤ ਨਹੀਂ ਕੀਤਾ ਜਾਵੇਗਾ। ਲੋੜੀਂਦੇ ਖੇਤਰਾਂ ਨੂੰ ਚਿੰਨ੍ਹਿਤ ਕੀਤਾ ਗਿਆ ਹੈ *