Help with Testing Monitor One

Hello all. I'm new to this and I'm in the process of learning how to use my new Monitor One. It has an M12 8-Pin connector with some wire outputs built in, and I was looking to transmit a 5V signal from my Arduino to this pin and publish it in the event monitor. However, it keeps reading 0 and I'm not sure what is the pin internally that that analog in wire (yellow) connects to. I assumed it was A6 based on the documentation so that's what I've been using, but I'm not sure. I was wondering if anyone could let me know if that's the right pin number to use in the code, or if I have to do any additional wiring to get it to communicate. Thanks!

1 Like

Hi and welcome to the community!

On the file monitor_edge_ioexpansion.h we can find:

#define MONITOREDGE_IOEX_VOLTAGE_IN_PIN (A6)

So I guess you are right, this is A6.

How are you reading it? The monitor one reads it like so:

auto rawVoltage = analogRead(MONITOREDGE_IOEX_VOLTAGE_IN_PIN);

Finally, how are you connecting the boards? Did you connect GND between them?

Thanks

Below I have attached my code. I'm not sure if I'm formatting the code in this post correctly, so I apologize about that.

#include "Particle.h"

SerialLogHandler logHandler(LOG_LEVEL_INFO);
SYSTEM_THREAD(ENABLED);

void setup() {
    pinMode(A6, INPUT);
}

void loop() {
int ArduinoIn = analogRead(A6);
Particle.publish("Arduino", String(ArduinoIn));
delay(30000); //delay half-minute
}

I see.

The easiest would be to start with the Monitor Edge firmware:

There are instructions how to use it in the README of that repo.

It will enable power to the I/O card which migth be required to power the input you are trying to read.
Then you add your exact code in loop() of the monitor main.cpp file:

void loop()
{
    Edge::instance().loop();

    int ArduinoIn = analogRead(A6);
    Particle.publish("Arduino", String(ArduinoIn));
    delay(30000); //delay half-minute
}

or without blocking loop() (recommended):

void loop()
{
    Edge::instance().loop();

    static unsigned long publishTime = 0;
    if ((millis() - publishTime) > 30000)
    {
        Log.info("publishTime...");
        publishTime = millis();
        int ArduinoIn = analogRead(A6);
        Particle.publish("Arduino", String(ArduinoIn));
    }

}

Best of luck!

2 Likes