2128 views|3 replies

222

Posts

3

Resources
The OP
 

[DFRobot Skylark Weather Meter Review] Arduino Wireless Intelligent Air Monitoring System Construction-04 Full-color OLED Display to Obtain Data [Copy link]

This post was last edited by eew_TKwwQ7 on 2023-12-3 23:09

1. Functionality

Connect the DFRobot Skylark weather meter to the Arduino development board to display the data collected by the Skylark weather meter in real time. The hardware required is:

The module uses SPI interface and can be driven by Arduino corresponding Adafruit_SSD1331 and SPI library. The module resolution is 96*64, which is enough for personalized display data. In order to facilitate operation, OLED is directly inserted into the development board, and the microcontroller is directly driven and powered (the working current is less than 30mA, which can be directly driven and powered)

Serial number Pinout name ARDUINO PINOUT
1 GND Power Ground /
2 VCC Power positive Pin13
3 SCX Clock Line Pin12
4 SDA Data cable Pin11
5 RES Reset line Pin10
6 DC Data/Command Pin9
7 CS Chip Select Pin8

Full color OLED screen information: 7pin彩屏RGB_0.95oled_TEST.rar (1.59 MB, downloads: 0)

2. Program Code


#include "DFRobot_LarkWeatherStation.h"
#include <Wire.h>
#include <Arduino.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1331.h>
#include <SPI.h>

#define DEVICE_ADDR                  0x42

#define MODESWITCH        /*UART:*/0 /*I2C: 0*/

#define sclk   12//SCL
#define mosi    11//SDA
#define cs      8// CS
#define rst    10//RES
#define dc     9//DC
// Color definitions
#define  BLACK          0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0  
#define WHITE           0xFFFF


Adafruit_SSD1331 display = Adafruit_SSD1331(cs, dc, mosi, sclk, rst);  

DFRobot_LarkWeatherStation_I2C atm(DEVICE_ADDR,&Wire);
void setup(void){
Serial.begin(115200);
atm.begin();

pinMode(13, OUTPUT);//OLED供电
digitalWrite(13,HIGH);//OLED供电
display.begin();//OLED初始化
display.fillScreen(BLACK);//OLED清屏
}

void loop(void){
    Serial.println("----------------------------");
    Serial.print(atm.getValue("Temp"));
    Serial.println(atm.getUnit("Temp"));
    Serial.print(atm.getValue("Humi"));
    Serial.println(atm.getUnit("Humi"));
    Serial.print(atm.getValue("Speed"));
    Serial.println(atm.getUnit("Speed"));
    Serial.println(atm.getValue("Dir"));
    Serial.print(atm.getValue("Altitude"));
    Serial.println(atm.getUnit("Altitude"));
    Serial.print(atm.getValue("Pressure"));
    Serial.println(atm.getUnit("Pressure"));
    Serial.println("----------------------------");
    Serial.println(atm.getInformation(true));
    delay(100);

display.setCursor(0, 0);display.setTextColor(BLACK);display.setTextSize(2);display.println("DFROBOT"); 
display.setCursor(0, 16);display.setTextColor(BLACK);display.setTextSize(1);display.print("Temp:"); display.print(atm.getValue("Temp")); 
display.setCursor(0, 24);display.setTextColor(BLACK);display.setTextSize(1);display.print("Humi:"); display.print(atm.getValue("Humi")); 
display.setCursor(0, 32);display.setTextColor(BLACK);display.setTextSize(1);display.print("Speed:"); display.print(atm.getValue("Speed")); 
display.setCursor(0, 40);display.setTextColor(BLACK);display.setTextSize(1);display.print("Dir:"); display.print(atm.getValue("Dir")); 
display.setCursor(0, 48);display.setTextColor(BLACK);display.setTextSize(1);display.print("Altitude:"); display.print(atm.getValue("Altitude")); 
display.setCursor(0, 56);display.setTextColor(BLACK);display.setTextSize(1);display.print("Pressure:"); display.print(atm.getValue("Pressure")); 




display.setCursor(0, 0);display.setTextColor(RED);display.setTextSize(2);display.println("DFROBOT"); 
display.setCursor(0, 16);display.setTextColor(YELLOW);display.setTextSize(1);display.print("Temp:"); display.print(atm.getValue("Temp")); 
display.setCursor(0, 24);display.setTextColor(BLUE);display.setTextSize(1);display.print("Humi:"); display.print(atm.getValue("Humi")); 
display.setCursor(0, 32);display.setTextColor(GREEN);display.setTextSize(1);display.print("Speed:"); display.print(atm.getValue("Speed")); 
display.setCursor(0, 40);display.setTextColor(CYAN);display.setTextSize(1);display.print("Dir:"); display.print(atm.getValue("Dir")); 
display.setCursor(0, 48);display.setTextColor(MAGENTA);display.setTextSize(1);display.print("Altitude:"); display.print(atm.getValue("Altitude")); 
display.setCursor(0, 56);display.setTextColor(WHITE);display.setTextSize(1);display.print("Pressure:"); display.print(atm.getValue("Pressure")); 


}

3. Display Effect

The above is the full-color OLED display to obtain data content

WeChat_20231203230552

This post is from Sensor

Latest reply

That's another app, it's better to make one that can be viewed offline   Details Published on 2023-12-4 11:42
 
 

6027

Posts

6

Resources
2
 

The screen is a bit small. This sensor has many parameters, so they must be fully displayed.

This post is from Sensor

Comments

Later, the labview computer host computer was used to display  Details Published on 2023-12-4 10:08
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

222

Posts

3

Resources
3
 
Qintianqintian0303 posted on 2023-12-4 09:44 The screen is a bit small. This sensor has a lot of parameters, so they must be fully displayed.

Later, the labview computer was used to display


This post is from Sensor

Comments

That's another app, it's better to make one that can be viewed offline  Details Published on 2023-12-4 11:42
 
 
 

6027

Posts

6

Resources
4
 
eew_TKwwQ7 posted on 2023-12-4 10:08 Later, it will be displayed on the computer using labview

That's another app, it's better to make one that can be viewed offline

This post is from Sensor
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list