I’ve got several SSD1306 based 0.96″ OLED screens around so I decided to use one of them to show some information that I receive from the HC-12.
The first step was to connect it to Arduino Mini/Pro and display a test.
My OLED has the following pins / markings on it ( I hope you can see them ):
However, they are not very accurate, as it’s actually not an I2C, but SPI (Maybe it’s multi-mode, I don’t know, but it works in SPI). This means, actually, the pins are:
- GND – connect to Arduino GND
- VCC – connect to Arduino 3.3v
- SCK – connect to Arduino pin 10
- MOSI – connect to Arduino pin 9
- RESET – connect to Arduino pin 13
- Data/Command – connect to Arduino pin 11
You can see in the Arduino sketch that I have much more code than needed 🙂 That’s because I will be using it later, so I added some extra helper functions. You can also see that I haven’t connected the CS, although it’s specified. I don’t have it on my OLED. If you have it, connect it to pin 12.
You have to install the U8glib file from the Library Manager ( Arduino -> Sketch -> Include Library -> Manage Libraries… ), as that’s what I’m using here.
Here’s the sketch file that simply displays Test 1, aligned to the right, on row 1 ( second row ).
And that’s the final result:
In the next post, I will connect HC-12 to the BMP180 and Arduino and send some data, which later will be read from another HC-12 and shown on the OLED.