Search code examples
node.jsasciiraspberry-pi3i2cnode-red

Sending ascii string command over i2c with node-red gpio or i2c


I'm looking to send an ascii string over I2C in node-red to a Atlas Scientific pH I2C module.

I currently have tried using the node red contrib gpio and i2c. I am able to send the command r as ascii number 114 and get a response.
But when I try the command sleep it does not work.

I have tried to send it as an array, individual ascii numbers with delays, a string of numbers, all as one number, with null byte.

None has worked so far, the manual says that the commands consist of 5 parts.

Start-I2C address-Write-Command(ascii command string)-stop.

In the SDA and SCL diagram it shows,

address bit->write->ack->first letter of command->ack->......->last letter of command->ack->stop.

Am I inputting the data in the wrong format or is there a problem with the i2c node waiting for the ack before sending the next letter?


Solution

  • Formatting the command as a hex array through the function node worked.

    [0x73,0x6c,0x65,0x65,0x70]