Hallo Zusammen,
da ich mich bisher nur wenig mit dem Arduino Nano Board beschäftigt habe hier mal eine Frage zu einem Problem was ich bisher nicht lösen konnte.
Ich bin dabei über zwei Wägezellen (YZC-133 2kg, YZC-133 3kg) einem OLED und einer LED Anzeige Daten bzw Gewichte anzeigen zu lassen. Was ich bisher hinbekommen habe ist das die Anzeige des OLED Daten ausgibt aber keine Daten (Gewicht ) aus dem YZC-133.
Der Quellcode (hier der Anfang) sieht so aus: (siehe auch Anhang)
/*
CG Scale main components:
1 pc load sensor front YZC-133 2kg
1 pc load sensor rear YZC-133 3kg
2 pc HX711 ADC, one for each load sensor (128bit resolution)
1 pc Arduino Nano
1 pc 16*2 HD44780 LCD + I2C-Adapter
or
1 pc 0,96" SSD1306-kompatible OLED with 128x64px
3D printed parts
Max model weight with sensors above: 4 to 4,5kg depending on CG location
5 kg at a CG of 83,9mm with Sensors above ;)
##################
##################
*/
#define vCGscale "v1.0"
#include <HX711_ADC.h>
/*https://github.com/olkal/HX711_ADC can be installed from the library manager
Number of samples and some filtering settings can be adjusted in the HX711_ADC.h library file
The best RATE setting is usually 10SPS, see HX711 data sheet (HX711 pin 15, can usually be set by a solder jumper on the HX711 module)
RATE 80SPS will also work fine, but conversions will be more noisy, so consider increasing number of samples in HX711_ADC.h
*/
//LCD
/*sketch for PCF8574T I2C LCD Backpack
http://tronixlabs.com/display/lcd/serial-i2c-backpack-for-hd44780-compatible-lcd-modules/
Use library from https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
*/
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7); // 0x27 is the I2C bus address for an unmodified backpack
/*sketch for PCF8574T I2C LCD Backpack
http://tronixlabs.com/display/lcd/serial-i2c-backpack-for-hd44780-compatible-lcd-modules/
Uses library from https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
*/
//OLED
/*
Library and Example at Adafruit https://learn.adafruit.com/monochrome-oled-breakouts/arduino-library-and-examples
-> To save RAM here the "lighter" ASCII-Only-Library (SSD1306Ascii) from William Greiman is used
Published here: https://github.com/greiman/SSD1306Ascii
*/
#define I2C_ADDRESS 0x3C // 0x3C or 0x3D are common I2C bus addresses
#include <Wire.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"
SSD1306AsciiWire oled;
//HX711 constructor (dout pin, sck pint):
HX711_ADC LoadCell_1(A2, A3); //HX711 pins front sensor (DOUT, PD_SCK)
HX711_ADC LoadCell_2(A0, A1); //HX711 pins rear sensor (DOUT, PD_SCK)
byte ledPin = 13; //Onboard LED
byte batRefPin = A6; //Batt Input
String sBattvalue = "";
String sVal = "";
String vString = "";
char toLCD[20];
int output; //0=Serial Terminal, 1=serial Output to LCD-Arduino, 2=I2C-LCD-Output
boolean ledState;
long t1;
long t2;
long t3;
const int printInterval = 500; // LCD/Serial refresh interval
//*** configuration:
//*** set dimensional calibration values:
const long WingPegDist = 1198; //calibration value in 1/10mm, projected distance between wing support points, measure with calliper
const long LEstopperDist = 300; //calibration value 1/10mm, projected distance from front wing support point to leading edge (stopper pin), measure with calliper
//*** set scale calibration values (best to have the battery connected when doing calibration):
float ldcell_1_calfactor = 994.1; //CG-weiß: 952.0; // CG-Gold: 1096.0, CG-Weiss: 952.0; user set calibration factor load cell front (float)
float ldcell_2_calfactor = 708.1; //CG-weiß: 727.0; // CG-Gold: 722.5, CG-Weiss: 727.0; user set calibration factor load cell rear (float)
//***
const long stabilisingtime = 3000; // tare precision can be improved by adding a few seconds of stabilising time
//***
const long CGoffset = ((WingPegDist / 2) + LEstopperDist) * 10;
//##########################################################################################
void setup() {
//***
output = 0; //change to 2 for I2C-LCD, output = 0 for Serial terminal (for calibrating), 0=Serial Terminal, 1=serial Output to LCD-Arduino, 2=I2C-LCD-Output
}
Eingebunden sind die Lib:
<HX711_ADC.h>
<LCD.h>
<LiquidCrystal_I2C.h>
<Wire.h>
"SSD1306Ascii.h"
"SSD1306AsciiWire.h"
Die Verdrahtung erfolgte nach diesem Plan:
Was im Moment nicht klappt ist das das LCD keine Anzeige anzeigt und das das Gewicht nicht angezeigt wird. Was ich im Moment noch nicht angeschlossen habe ist die 9V Stromversorgung.
Welche Probleme könnte ich hier haben?
Danke
Gruß
Reinhold
CG_scale_RCN.ino (13 KB)