【Follow me Season 2 Episode 2】Task 2: LED matrix + DAC sine + op amp amplification + ADC acquisition and printing
[Copy link]
This post was last edited by dvacos on 2024-9-21 15:23
1. LED Matrix
Text Display:
I discovered by chance that the ArduinoGraphics library can display text on the LED matrix, so I used it to create the following effect.
Code:
//固定字
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
void setup() {
matrix.beginDraw();
matrix.stroke(0xFFFFFFFF);
const char text[] = "Hello";
matrix.textFont(Font_5x7);
matrix.beginText(0, 1, 0xFFFFFF);
matrix.println(text);
matrix.endText();
matrix.endDraw();
}
void loop() {
}
Scrolling Text
Since the LED matrix is very small and the resolution is very low, it can only display a few letters, so the scrolling code is added, so the effect is as follows
Code:
//滚动灯
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
void setup() {
matrix.begin();
}
void loop() {
matrix.beginDraw();
matrix.stroke(0xFFFFFFFF);
matrix.textScrollSpeed(100);
const char text[] = " Hello EEWorld! ";
matrix.textFont(Font_5x7);
matrix.beginText(0, 1, 0xFFFFFF);
matrix.println(text);
matrix.endText(SCROLL_LEFT);
matrix.endDraw();
}
2. DAC generates sine wave
DAC pin confirmation
So by connecting the oscilloscope to A0, you can see the following waveform, a sine wave with a frequency of 1khz.
3. OPAMP amplifies DAC signal
The amplified output signal should not exceed ~4.7 V, otherwise clipping will occur and may even damage the board, so reduce the voltage of the sine wave generated by the DAC
4.64v before reduction
After reducing 2.44v
Code to add:
Wiring Diagram
Very important!!! If connected incorrectly, the voltage will not be amplified
A0 - A1 provides the DAC output voltage
One end of the resistor is grounded, the midpoint is connected to A2, and the other end is connected to A3
Experimental results
4. ADC collects voltage and prints
Based on the third point, connect the voltage output by A3 op amp to A4, and the voltage generated by A0DAC to A5
Since the host computer cannot scale the Y axis (or I don't know how to do it), I can only barely see it.
The above are all the tasks for Task 2!!!
|