Arduino code to send voltage, current and power to the things network with uplink

Assuming TTN Console (or some gateway log) showed that a downlink should have been transmitted, you need to figure out why your device is not receiving it. You can start by adding the following to the setup, for example after the line for LMIC_setDrTxpow:

// Make LMIC start its RX windows a bit earlier, and listen longer, to
// compensate for an inaccurate clock.
//
// Beware that a specific value may work for a slow data rate, but not
// for faster ones, and remember that RX1 may use different data rates
// than RX2. Like for some tests, RX2 in EU868 (using SF9) worked with
// the standard settings, but RX1 for SF8 needed 2%, while RX1 for SF7
// even needed 5% of the maximum error. For corrections exceeding 0.4%
// (0.4 / 100) this also needs LMIC_ENABLE_arbitrary_clock_error; see
// https://github.com/mcci-catena/arduino-LMIC/blob/master/README.md
LMIC_setClockError(MAX_CLOCK_ERROR * 5 / 100);

Be sure to read the link mentioned in the comment above; the example value of 5% is much higher than the 0.4% mentioned in that documentation. So, you’ll need to set the compile-time flag LMIC_ENABLE_arbitrary_clock_error, or when using the Arduino editor, set the flag in the file Arduino/libraries/MCCI_LoRaWAN_LMIC_library/project_config/lmic_project_config.h

Also note the following comment in LMIC’s source code: