# Collecting Sensor Data (tutorial)

**URL:** <https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404>\
**Category:** Firmware\
**Created:** [October 25, 2024, 9:01pm UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404 "2024-10-25T21:01:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andres18](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@Andres18](https://discuss.blues.com/u/Andres18)\
**Post date:** [October 25, 2024, 9:01pm UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404/1 "2024-10-25T21:01:02Z")

</div>

On this Step:  
If you’re using PlatformIO, open the Serial Monitor by clicking the plug icon in the bottom of VS Code.

You should see a few debug messages, including the JSON object you sent, as well as the response from the Notecard {}. (Note: You might need to upload your code a second time to see the result of the hub.set request, as the Serial Monitor only captures output when it’s actively running.)

after i got the success messages after running my code. On the monitor task instead of having this:  
{“req”:“hub.set”,“product”:“com.blues. tvantoll:weather”, “mode”:“continuous”, “body”:{“a  
gent”:“note-arduino”,“compiler”:“gcc 9.2.1 20191025 (release) [ARM/arm-9-branch revisi  
on 277599]”,“req\_interface”:“i2c”,“cpu\_name”:“swan\_r5”}}

I got some errors:  
[ERROR] i2c: received NACK on transmit of data {io}  
[ERROR] error encountered during I2C transmit hook execution  
[ERROR] i2c: received NACK on transmit of data {io}  
[ERROR] error encountered during I2C transmit hook execution  
[ERROR] i2c: received NACK on transmit of data {io}  
[ERROR] error encountered during I2C transmit hook execution

Also mine don’t say Monitor task, instead it says PlataformIO.

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [October 28, 2024, 7:45pm UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404/2 "2024-10-28T19:45:38Z")

</div>

Hey @Andres18,

Welcome to the Blues community! And sorry you hit an issue here.

To start, could you let me know what firmware version your Notecard is using? (You can get that by running the `card.version` request.)

Can you also try to power cycle the device to see if this error is happening consistently?

Thanks,  
TJ

---

<div class="post-metadata">

**Author:** ![Andres18](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@Andres18](https://discuss.blues.com/u/Andres18)\
**Post date:** [October 29, 2024, 3:09pm UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404/3 "2024-10-29T15:09:57Z")

</div>

**This is my platformio:**  
[env:bw\_swan\_r5]  
platform = ststm32  
board = bw\_swan\_r5  
upload\_protocol = dfu  
framework = arduino  
build\_flags = -D PIO\_FRAMEWORK\_ARDUINO\_ENABLE\_CDC  
monitor\_speed = 115200  
lib\_deps =  
Wire  
blues/Blues Wireless Notecard@^1.6.0

**This is my Main CPP:**  
#include \<Arduino.h\>  
#include \<Notecard.h\>

#define usbSerial Serial  
#define productUID “edu.ncsu.aalop…”

Notecard notecard;

void setup()  
{  
// initialize digital pin LED\_BUILTIN as an output.  
delay(2500);  
usbSerial.begin(115200);

notecard.begin();  
notecard.setDebugOutputStream(usbSerial);

J \*req = notecard.newRequest(“hub.set”);  
JAddStringToObject(req, “product”, productUID);  
JAddStringToObject(req, “mode”, “continuous”);  
notecard.sendRequest(req);

}

// the loop function runs over and over again forever  
void loop()  
{

}

After i run it i get a success messages!!! but the next step to press the serial Monitor and see the request. i see these errors and i can’t establish connection to my bluenotehub . I have connect the USB to the sawn nothing else connect it.

[ERROR] error encountered during I2C transmit hook execution  
[ERROR] i2c: received NACK on transmit of data {io}  
[ERROR] error encountered during I2C transmit hook execution  
[ERROR] i2c: received NACK on transmit of data {io}  
[ERROR] error encountered during I2C transmit hook execution  
[ERROR] i2c: received NACK on transmit of data {io}  
[ERROR] error encountered during I2C transmit hook execution  
[ERROR] i2c: received NACK on transmit of data {io}  
[ERROR] error encountered during I2C transmit hook execution

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [October 29, 2024, 4:20pm UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404/4 "2024-10-29T16:20:09Z")

</div>

Can you run the [`card.version` request](https://dev.blues.io/api-reference/notecard-api/card-requests/latest/#card-version) using the [In-Browser Terminal](https://dev.blues.io/terminal/) and paste in what you get back here?

I’d like to see what firmware version your Notecard is using first.

Thanks,  
TJ

---

<div class="post-metadata">

**Author:** ![Andres18](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@Andres18](https://discuss.blues.com/u/Andres18)\
**Post date:** [November 9, 2024, 12:53am UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404/5 "2024-11-09T00:53:42Z")

</div>

Hey,  
version": “notecard-7.4.2.16888”,  
“device”: “dev:351077454529689”,  
“name”: “Blues Wireless Notecard”,  
“sku”: “NOTE-WBGLW”,  
“ordering\_code”: “HB0YT1N0AEAU”,  
“board”: “5.13”,  
“wifi”: true,  
“cell”: true,  
“gps”: true,  
“api”: 7,  
“body”: {  
“org”: “Blues Wireless”,  
“product”: “Notecard”,  
“target”: “u5”,  
“version”: “notecard-u5-7.4.2”,  
“ver\_major”: 7,  
“ver\_minor”: 4,  
“ver\_patch”: 2,  
“ver\_build”: 16888,  
“built”: “Aug 27 2024 19:08:01”

---

<div class="post-metadata">

**Author:** ![Andres18](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@Andres18](https://discuss.blues.com/u/Andres18)\
**Post date:** [November 9, 2024, 12:55am UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404/6 "2024-11-09T00:55:26Z")

</div>

#include \<Arduino.h\>  
#include \<Notecard.h\>

#define usbSerial Serial  
// #define productUID “andresnotehubproject”  
#define productUID “com.renago.datweneb:testrun”

Notecard notecard;

Main cpp:  
void setup() {  
// put your setup code here, to run once:  
delay(3500);  
usbSerial.begin(115200);

notecard.begin();  
notecard.setDebugOutputStream(usbSerial);

J \*req = notecard.newRequest(“hub.set”);  
JAddStringToObject(req, “product”, productUID);  
JAddStringToObject(req, “mode”, “continuous”);  
notecard.sendRequest(req);

}

void loop() {  
// put your main code here, to run repeatedly:

}

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [November 13, 2024, 9:32pm UTC](https://discuss.blues.com/t/collecting-sensor-data-tutorial/2404/7 "2024-11-13T21:32:58Z")

</div>

Hi @Andres18,

Usually the I2C issue you’re seeing is the result of either an I2C address conflict (i.e. do you have another I2C sensor/component that could be conflicting with the Notecard) or a wiring issue. Are you using a starter kit with the Notecarrier F or another Notecarrier? It might be worthwhile posting an image of your wiring.

Thanks,  
Rob
