{"id":61,"date":"2017-03-19T21:25:43","date_gmt":"2017-03-19T19:25:43","guid":{"rendered":"https:\/\/dev.drun.net\/?p=61"},"modified":"2017-03-19T21:25:43","modified_gmt":"2017-03-19T19:25:43","slug":"showing-some-data-with-cheap-oled-screens","status":"publish","type":"post","link":"https:\/\/dev.krasi.net\/?p=61","title":{"rendered":"Showing some text on cheap OLED screens"},"content":{"rendered":"<p>I&#8217;ve got several SSD1306 based 0.96&#8243; OLED screens around so I decided to use one of them to show some information that I receive from the HC-12.<\/p>\n<p>The first step was to connect it to Arduino Mini\/Pro and display a test.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"https:\/\/dev.krasi.net\/wp-content\/uploads\/2017\/03\/DSCF3302-300x200.jpg\" alt=\"\" width=\"300\" height=\"200\" \/><\/p>\n<p>My OLED\u00a0has the following pins \/ markings on it ( I hope you can see them ):<\/p>\n<ul>\n<li>GND<\/li>\n<li>VCC<\/li>\n<li>SCL<\/li>\n<li>SDA<\/li>\n<li>RST<\/li>\n<li>D\/C<\/li>\n<\/ul>\n<p>However, they are not very accurate, as it&#8217;s actually not an I2C, but SPI (Maybe it&#8217;s multi-mode, I don&#8217;t know, but it works in SPI). This means, actually, the pins are:<\/p>\n<ul>\n<li>GND &#8211; connect to Arduino GND<\/li>\n<li>VCC &#8211; connect to Arduino 3.3v<\/li>\n<li>SCK &#8211; connect to Arduino pin 10<\/li>\n<li>MOSI &#8211; connect to Arduino pin 9<\/li>\n<li>RESET &#8211; connect to Arduino pin 13<\/li>\n<li>Data\/Command &#8211; connect to Arduino pin 11<\/li>\n<\/ul>\n<p>You can see in the Arduino sketch that I have much more code than needed \ud83d\ude42 That&#8217;s because I will be using it later, so I added some extra helper functions. You can also see that I haven&#8217;t connected the CS, although it&#8217;s specified. I don&#8217;t have it on my OLED. If you have it, connect it to pin 12.<\/p>\n<p>You have to install the U8glib file from the Library Manager ( <em>Arduino -&gt; Sketch -&gt; Include Library -&gt; Manage Libraries&#8230;<\/em> ), as that&#8217;s what I&#8217;m using here.<\/p>\n<p><a href=\"https:\/\/dev.drun.net\/wp-content\/uploads\/2017\/03\/test-1.ino\">Here&#8217;s the sketch file<\/a>\u00a0that simply displays <strong>Test 1<\/strong>, aligned to the right, on row 1 ( second row ).<\/p>\n<p>And that&#8217;s the final result:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-68 size-large\" src=\"https:\/\/dev.krasi.net\/wp-content\/uploads\/2017\/03\/DSCF3294-1024x683.jpg\" alt=\"\" width=\"960\" height=\"640\" \/><\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve got several SSD1306 based 0.96&#8243; 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\u00a0has the following pins \/ markings on it ( I hope you can see them ): GND VCC SCL SDA RST D\/C However, they are not very accurate, as it&#8217;s actually not an I2C, but SPI (Maybe it&#8217;s multi-mode, I don&#8217;t know, but it works in SPI). This means, actually, the pins are: GND &#8211; connect to Arduino GND VCC &#8211; connect to Arduino 3.3v SCK &#8211; connect to Arduino pin 10 MOSI &#8211; connect to Arduino pin 9 RESET &#8211; connect to Arduino pin 13 Data\/Command &#8211; connect to Arduino pin 11 You can see in the Arduino sketch that I have much more code than needed \ud83d\ude42 That&#8217;s because I will be using it later, so I added some extra helper functions. You can also see that I haven&#8217;t connected the CS, although it&#8217;s specified. I don&#8217;t have it on my OLED. If you have it, connect it to pin 12. You have to install the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":68,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[],"class_list":["post-61","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hardware","category-software"],"_links":{"self":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=61"}],"version-history":[{"count":0,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}