SparkFun Forums 

Where electronics enthusiasts find answers.

Hardware or product specific questions are best asked here.
#249203
Hi everyone -- first time poster but need some help with a project I'm trying to replicate using the following hardware:

- Artemis Thing Plus
- Micro OLED
- Max30101

I'm following the instructions on building a roasted coffee color analyzer found here https://github.com/juztins-lab/roast-meter

After assembling the hardware I followed instructions on adding the board manager to my Arduino preferences, uploaded the necessary libraries, verified/uploaded the sketch to the board but for some reason the OLED just won't turn on at all. After consulting a couple of people who successfully replicated this project and tried to even run the example Artemis OLED sketches to no avail we guessed maybe the OLED was DOA. SparkFun was great and sent a replacement but still no dice when assembling and running everything. I swapped position of QWIIC cables and that didn't help at all. Any help from more experienced folks out there would be much appreciated!

Attached are some photos and here's the code:


#include <SFE_MicroOLED.h>

#include <MAX30105.h>
#include <heartRate.h>
#include <spo2_algorithm.h>

// VERSION 1.0.1-beta
#include <SFE_MicroOLED.h>
#include <Wire.h>

#include "MAX30105.h"

#define PIN_RESET 9
#define DC_JUMPER 1

MAX30105 particleSensor;
MicroOLED oled(PIN_RESET, DC_JUMPER);

long unblockedValue; // Average IR at power up

String multiplyChar(char c, int n) {
String result = "";
for (int i = 0; i < n; i++) {
result += c;
}
return result;
}

void displayMeasurement(int rLevel) {
oled.clear(PAGE);
oled.setCursor(0, 0);

int calibratedReading = f(rLevel);
int centerPadding = 4 - String(calibratedReading).length();
String paddingText = multiplyChar(' ', centerPadding);

if (rLevel == 0) {
oled.setFontType(1);
oled.print("Please load sample!");
oled.display();
return;
}

oled.setFontType(3);
oled.print(paddingText);
oled.print(calibratedReading);

Serial.println("real:" + String(rLevel));
Serial.println("agtron:" + String(calibratedReading));
Serial.println("===========================");

oled.display();
}

int f(int x) {
int intersectionPoint = 117;
float deviation = 0.165;

return round(x - (intersectionPoint - x) * deviation);
}

void setup() {
Serial.begin(9600);

Wire.begin();
oled.begin(); // Initialize the OLED
oled.clear(ALL); // Clear the display's internal memory
oled.clear(PAGE); // Clear the buffer.

delay(100); // Delay 100 ms
oled.setFontType(3);

// Initialize sensor
if (particleSensor.begin(Wire, I2C_SPEED_FAST) == false) // Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
while (1)
;
}

// The variable below calibrates the LED output on your hardware.
byte ledBrightness = 135;

byte sampleAverage = 4; // Options: 1, 2, 4, 8, 16, --32--
byte ledMode = 2; // Options: 1 = Red only, --2 = Red + IR--, 3 = Red + IR + Green
int sampleRate = 50; // Options: 50, 100, 200, 400, 800, 1000, 1600, --3200--
int pulseWidth = 411; // Options: 69, 118, 215, --411--
int adcRange = 16384; // Options: 2048, --4096--, 8192, 16384

particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); // Configure sensor with these settings

particleSensor.setPulseAmplitudeRed(0);
particleSensor.setPulseAmplitudeGreen(0);

particleSensor.disableSlots();
particleSensor.enableSlot(2, 0x02); // Enable only SLOT_IR_LED = 0x02

// Update to ignore readings under 30.000
unblockedValue = 30000;
}

void loop() {
int rLevel = particleSensor.getIR();
long currentDelta = rLevel - unblockedValue;

if (currentDelta > (long)100) {
displayMeasurement(rLevel / 1000);
} else {
displayMeasurement(0);
}
delay(100);
}

Image
You do not have the required permissions to view the files attached to this post.
#249268
Hi JJWoodrow,

I can't completely replicate your setup as I don't have a MAX30101 board. But I've tried running a couple of Micro OLED examples on the Artemis Thing Plus, and they're working OK for me.

Suggestions:
Check which version of the SparkFun Apollo3 Board package you have installed - from the Tools \ Board \ Board Manager. v2.2.1 is the latest; use that.
Double-check you have selected "Artemis Thing Plus" as the board - from Tools \ Board \ SparkFun Apollo3. If you have a different Apollo3 board selected, that could explain why Wire (I2C) isn't working.
Check which version of the Micro OLED Breakout Library you have installed - Tools \ Manage Libraries. v1.3.4 is the latest; use that.
"Wire" is working for me. No changes required there. (If you were using the SDA1 amd SCL1 breakout pads instead of Qwiic, you'd need "Wire1". But you aren't...)
The default OLED address is working for me. No changes required there. (If you had closed the ADDR jumper on the OLED, you'd need to change DC_JUMPER to match. But you haven't...)
Try removing the MAX30101. Connect the OLED direct to the Artemis. Run one of the examples from the Micro OLED library - File \ Examples \ SparkFun Micro OLED Breakout. Does that work?
Try swapping Qwiic cables. Does that help?

Hope this helps,
Paul
#249269
Thanks for your reply Paul - I appreciate it.

Board package installed = v2.2.1
Board selected = Artemis Thing Plus
Micro OLED Breakout Library installed = v1.3.4

I've swapped the Qwiic cables previously with no change. I'm pretty positive I've already tried connecting the OLRD directly to the Artemis without success but I will try that again when I get home today.

I'm just perplexed considering everything seems to be connected, uploaded, etc fine but blank screen syndrome lol
#249276
Well at least one thing is now determined, somehow the longer of the two QWIIC cables is bad or loose or something. I tried what you suggested and removed the MAX from the equation. Plugged the OLED into the Artemis using the short cable and the example sketch worked perfect after I figured which port it preferred (not the QWIIC one btw). I then connected the MAX back into the equation and nothing. Switch cables and nothing to the OLED from the Artemis using the longer cable. Is there a way to check and see if there is a way to repair this? I gently tugged on each of the wires and they all seem solid and tight. Not sure what the deal is but for sure the one cable isn't working.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum