You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Waveshare 0.91 inch OLED Display (this one) and I have been looking at adding it to the body in place of the voltmeter. This would mean we could make use of the voltage divider in the PCB to monitor the voltage, report on voltage to the Pi, and still view it on the OLED display.
It also allows more output from the Arduino, which I'd be keen to have as it's tricky to debug when the serial output goes straight to the Pi.
I created a basic script, which works in isolation and when integrated into the main arduino_sketch. There are, however, two issues:
The MPU6050 blocks this module from working. I suspect because they are both I2C and conflicting (the addresses are different, so it is something else).
The ServoManager module causes noise on the display, in the form of random characters on the last line. I expect this is related to the serial output that is sent back to the Pi, but I haven't tested this.
The code:
// Changes to arduino_sketch.ino
#include "Display.h"
Display disp;
// Setup
disp.doInit();
disp.refresh();
// Loop
disp.refresh(); // @todo this does not need to happen every loop. Once a second would be sufficient.
// Display.h
#ifndef DISPLAY_H
#define DISPLAY_H
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define SCREEN_ADDRESS 0x3C
// Initialize the display
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire);
/**
* @file Display.h
* @brief Display class for the Arduino sketch.
* @details This file contains the Display class for the Waveshare 0.91 inch OLED I2C display
*/
class Display{
public:
void doInit()
{
// Initialize the display with the I2C address of your OLED screen
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;)
;
}
}
void refresh()
{
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.print(millis());
//display.println(legModeNames[legMode]);
display.setTextSize(2);
display.setCursor(0, 8);
//display.print(voltage);
display.println("V");
display.setTextSize(1);
display.setCursor(0, 24);
display.println("www.makerforge.tech");
display.display();
}
};
#endif
The servo manager code is here: ServoManager. Disabling servoManager.doInit(); in arduino_sketch.ino seems to resolve the noise.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Waveshare 0.91 inch OLED Display (this one) and I have been looking at adding it to the body in place of the voltmeter. This would mean we could make use of the voltage divider in the PCB to monitor the voltage, report on voltage to the Pi, and still view it on the OLED display.
It also allows more output from the Arduino, which I'd be keen to have as it's tricky to debug when the serial output goes straight to the Pi.
I created a basic script, which works in isolation and when integrated into the main
arduino_sketch
. There are, however, two issues:The code:
The servo manager code is here: ServoManager. Disabling
servoManager.doInit();
inarduino_sketch.ino
seems to resolve the noise.The MPU6050 module is here: MPU6050.
HELP NEEDED: If anyone can advise on why these modules are conflicting, that would be a huge help.
The result is that the screen does not render or update at all if
MPU6050_ENABLED
is set inConfig.h
.I'll park this for now as it isn't critical, but would be good to resolve if possible.
Beta Was this translation helpful? Give feedback.
All reactions