Particle Argon Lcd

Tags: #<Tag:0x00007fe21fe91fc0>


What should I do now?


Can anybody here tell me how to get an I2C 1602 lcd work with Argon. Please send a working circuit diagram and program for it.


@Vilaksh, did you understand what @ScruffR told you that chances are, you have damaged the I2C port on your Argon? If not, re-read this topic and do not continue until you do understand.

If you want to interface a 5V I2C display (like yours) to an Argon, you will need the following:

  1. A 5v-3.3v level shifter like the one recommended by @shanevanj:

The connection is as follows:

Boron    Arduino    Level Shifter    I2C Display
3V3                      LV
GND                      GND
            5V           HV             Vcc
            GND          GND
GND         GND                         GND
SCA                      A1
SCL                      A2
                         B1             SCA
                         B2             SCL

You will not need I2C pull-up resistors if you use this board (it has them built in).

  1. If you power the display from a separate 5v source like an Arduino, you will need to connect the Arduino GND to the Argon GND.

You MUST have this in place BEFORE you apply power to your circuit.


Thank you all for your guidance. I made it work. Luckily my argon pins were not damaged and I can work with it now.


Also I want to read some data using webhook and display on lcd, I have some json data from google sheets (using gsxtojson I made an integration) in form of a list is it possible to show it up on lcd. Any demo code for that.


If you want help - you need to also attempt a few things - we don’t do the work for you. So post some code.

Secondly don’t double post - its just wastes everyones time


Thridly - I may add - try to read, understand and apply the given advice.

You still haven’t resolved the 5V issue - the I2C board on the display has its own 5V pull-up resistors and you added another set of 3.3V pull-ups resulting in a level greater 3.3V on your GPIOs and also “back-feeding” into the 3.3V supply on the Argon.


I am not able to get you. Would you please explain me.


I’m not sure if there is a way to clarify this more than @peekay123 did but i’ll will try.
On the attached picture you have Pololu logic level shifter you just need to use for example L1->SCL L2->SDA on 3,3V site and H1-> SCL H2-> SDA on 5V site that’s it. And of course connect 3,3V to LV and 5V to HV and GND.


Got it. One more thing how to fix this error


A recipe to fix any error is to investigate.

I’m absolutely certain (I have checked :wink: ) the ArduinoJson library features an example that shows how to properly get a string from a JsonVariant object.


as mentioned by @ScruffR, all you need is here:

Sometimes it’s good to dig a little deeper by self and be a little more patient before we asking a question.
Also you are iterating over an json object values which belongs to key: “crops” (will be easier if we can see example of your json ) you have to consider that after “for” is done your “text_var” it’s gonna be equal to the lastest value of {“crops”: [“foo”,“bar”,…,“22nd_value”] }


This is thr json data from integration


This doesn’t seem to be valid JSON.

The keys need to be strings (wrapped in double quotes) and each individual field in your array ([...]) should be wrapped in curly braces ( [ {"0":"PADDY"}, {"1":"JOWAR"}, ...])
You should feed your pseudo JSON into a online parser to get that sorted before moving on.


I was able to compile the test code with no errors for my argon. let’s say that you fix your json and it’s looks similar to this:
“columns”: {
“crops”: [
“rates”: [

// This #include statement was automatically added by the Particle IDE.
#include <SparkJson.h>

const size_t capacity = 2*JSON_ARRAY_SIZE(4) + 9*JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(2) + 90;

StaticJsonBuffer<capacity> jsonBuffer;

char* json = "{\"columns\":{\"crops\":[{\"0\":\"PADDY\"},{\"1\":\"JOWAR\"},{\"2\":\"BAJRA\"},{\"3\":\"MAIZE\"}],\"rates\":[{\"0\":1750},{\"1\":2430},{\"2\":1950},{\"3\":1700}]}}";

void setup() {


void loop() {
JsonObject& root = jsonBuffer.parseObject(json);

JsonArray&  cropsArray = root["columns"]["crops"];
JsonArray& ratesArray = root["columns"]["rates"];

const char* columns_crops_0_0 = cropsArray[0]["0"]; // "PADDY"
const char* columns_crops_1_1 = cropsArray[1]["1"]; // "JOWAR"
const char* columns_crops_2_2 = cropsArray[2]["2"]; // "BAJRA"
const char* columns_crops_3_3 = cropsArray[3]["3"]; // "MAIZE"

int columns_rates_0_0 = ratesArray[0]["0"]; // 1750
int columns_rates_1_1 = ratesArray[1]["1"]; // 2430
int columns_rates_2_2 = ratesArray[2]["2"]; // 1950
int columns_rates_3_3 = ratesArray[3]["3"]; // 1700

// or.......

for(JsonObject& result : cropsArray){

   JsonObject& crops = result;
   Serial.println(crops["0"].as<const char*>()); // "PADDY"
   Serial.println(crops["1"].as<const char*>()); // "JOWAR"
   Serial.println(crops["2"].as<const char*>()); // "BAJRA"
   Serial.println(crops["3"].as<const char*>()); // "MAIZE"


for(JsonObject& result : ratesArray){

   JsonObject& rates = result;
   Serial.println(rates["0"].as<int>()); // 1750
   Serial.println(rates["1"].as<int>()); // 2430
   Serial.println(rates["2"].as<int>()); // 1950
   Serial.println(rates["3"].as<int>()); // 1700



I used which is preatty usefull tools. and to learn how
to deal with json.
Please note that I did not tested / flashed this code to my argon !!!


Use a logic level shifter. that is the first thing that you should be doing. They are inexpensive and they will save your project. If you do not know how to set one up, that is OK, we can show you. With 5v and 3.3v, you risk destroying your project. at higher voltages and larger currents, you risk fire.

This is one way that you could hook up a logic level shifter to convert 5 and 3.3 volts.
You give the shifter power from both sets of voltage, then you feed it signal voltage on the correct side: 3.3v signal goes to the 3.3v power side and 5v signal to the 5v side.

Please note, i have no idea what your lcd pins should be, so they are just attached where it looked convenient. Also, I do not have a fritzing model for the xenon, only the photon and electron. You can set the pinouts to your xenon just by the pin name.


I am unable to fix my json. Will this be a valid one.`

{"rows":[{"crops":"PADDY","rates":1750},{"crops":"JOWAR","rates":2430},{"crops":"BAJRA","rates":1950},{"crops":"MAIZE","rates":1700},{"crops":"RAGI","rates":2897},{"crops":"ARHAR(Tur)","rates":5675},{"crops":"MOONG","rates":6975},{"crops":"URAD","rates":5600},{"crops":"COTTON","rates":5150},{"crops":"GROUNDNUT IN SHELL","rates":4890},{"crops":"SUNFLOWER SEED","rates":5388},{"crops":"SOYABEAN","rates":3399},{"crops":"SESAMUM","rates":6249},{"crops":"NIGERSEED","rates":5877},{"crops":"WHEAT","rates":1840},{"crops":"BARLEY","rates":1440},{"crops":"GRAM","rates":4620},{"crops":"MASUR (LENTIL)","rates":4475},{"crops":"RAPESEED/MUSTARD","rates":4200},{"crops":"SAFFLOWER","rates":4945},{"crops":"TORIA","rates":4190},{"crops":"JUTE","rates":3700},{"crops":"SUGARCANE $","rates":275}]}


This is valid.

Use to validate any Json. documents


I made one more test code which successful parse jour new json and flashed my Argon then publish results witch Particle.publish() . All works perfect !. Please note i’m not a programmer ! I even never “stood beside any professional one”, so the code is just for demonstrating the idea how to deal with json also parseFunc() will block for 24s maybe @ScruffR can add/correct something whch supose to be done in diffrent/easiest way.

// This #include statement was automatically added by the Particle IDE.
#include <SparkJson.h>
#include "Particle.h"

unsigned long  interval = 5000; 
char* json = "{\"rows\":[{\"crops\":\"PADDY\",\"rates\":1750},{\"crops\":\"JOWAR\",\"rates\":2430},{\"crops\":\"BAJRA\",\"rates\":1950},{\"crops\":\"MAIZE\",\"rates\":1700},{\"crops\":\"RAGI\",\"rates\":2897},{\"crops\":\"ARHAR(Tur)\",\"rates\":5675},{\"crops\":\"MOONG\",\"rates\":6975},{\"crops\":\"URAD\",\"rates\":5600},{\"crops\":\"COTTON\",\"rates\":5150},{\"crops\":\"GROUNDNUT IN SHELL\",\"rates\":4890},{\"crops\":\"SUNFLOWER SEED\",\"rates\":5388},{\"crops\":\"SOYABEAN\",\"rates\":3399},{\"crops\":\"SESAMUM\",\"rates\":6249},{\"crops\":\"NIGERSEED\",\"rates\":5877},{\"crops\":\"WHEAT\",\"rates\":1840},{\"crops\":\"BARLEY\",\"rates\":1440},{\"crops\":\"GRAM\",\"rates\":4620},{\"crops\":\"MASUR (LENTIL)\",\"rates\":4475},{\"crops\":\"RAPESEED/MUSTARD\",\"rates\":4200},{\"crops\":\"SAFFLOWER\",\"rates\":4945},{\"crops\":\"TORIA\",\"rates\":4190},{\"crops\":\"JUTE\",\"rates\":3700},{\"crops\":\"SUGARCANE $\",\"rates\":275}]}";

void parseFunc(char *data); // forward declaration

void setup() {
	char *dataCopy = strdup(json);


void parseFunc(char *mutableData) {
   const size_t capacity = JSON_ARRAY_SIZE(23) + JSON_OBJECT_SIZE(1) + 23*JSON_OBJECT_SIZE(2) + 670;
   StaticJsonBuffer<capacity> jsonBuffer;
   JsonObject& root = jsonBuffer.parseObject(mutableData);
   JsonArray& rowsArray = root["rows"];
        Particle.publish("parse failed",PRIVATE);
    for(JsonObject& result : rowsArray){

       JsonObject& rows = result;
       Particle.publish("crops", rows["crops"].asString(), 60, PRIVATE); //as<const char*>()
       Particle.publish("rates", String(rows["rates"].as<int>()), 60, PRIVATE);

void loop() {
if (millis() - interval > 5000) {
    char *dataCopy = strdup(json);
    interval = millis();

and results:


This is the spirit we want to encourage :+1:
Just get your hands dirty and try - this way you learn the most.

That’s why I said this earlier

Spoon-feeding solutions hardly encourages people to try to understand - when they have to put effort into investigation the understanding is a by-product and the acquired knowledge will stick with you much longer and the next problem will take you only a fraction of the time to find the solution.

You probably know the parable about it beeing better to teach someone to fish than just giving him one fish.