AD5252/AD5254 - I2C commandline

Hello All,

I've gone through the document for I2C and understand about header to Checksum for AD 5252 and 5254.  we are trying to make a script using serial com port instead of GUI.

Objectives : Making a script to set the value of channel 1/2 : 0 and 255 for the device AD5252, similar for AD5254 (Channel 4)

Issue : we are sending command via serial communication port but getting response is some Junk value (¬╝2♥X☺ √)

Suspection : whatever sending command is might be wrong – the command is [170, 7, 188, 50, 3, 88, 1, 0, 0, 251]

According to my understanding for AD5252 :
170 - Header, 7 - address byte (Payload), 188 - write command, 50 - Device address, 3 – data 1 , 88 - data 2, 1- data 3, 0 - data 4, 0 - data 5 & 251 - Checksum

Please let us know how we are going to send command either API data or Command data … & how & what command to send to enable the channel 1 and set 0 for AD 5252 device.

Thanks - Ravi

That command looks correct to set channel 1 to 0, the response is coming back in bytes and you are interpreting it as ASCII which is why it looks like junk. What language are you trying to write this script in?

Hello Trey,

Thanks for your kind information, we are using Python language. Could you please give some suggestion for how to interpret from ASCII to bytes.


More than likely its already a bytearray when it comes in. When you try and print the bytearray then python will try and convert it to a string.

How to print it depends on the object type that it is. If its a bytearray as it should be you can use print(list(your_byte_array_object)). At least that’s what working for me right now.

You can use the type() function and pass it your object to determine the type of the object.