Don't like ads? Help support the Mercs by becoming a Supporter or Auxiliary Member today!
Official Members also get to use the forum ad-free - so kit up and join us!

 electriFi tutorial: build your own OLED display

  • 64 Replies
  • 5909 Views

Fi-8015


    *
  • *
  • *
  • 2923
  • Awards 40% increase or more Award for 10 official invasions.
electriFi tutorial: build your own OLED display
« on: Mar 06, 2020, 12:18 PM »
In this tutorial I want to present instructions how to recreate OLED displays like the ones I used to offer.
I try to be as detailed as possible to ensure you can follow this guide without any electronics or coding knowledge.

Update: May 9, 20
The instructions are now updated to reflect the changes in the updated library. It got a bit easier now. The codes are already updated as well. Thanks to runger, who pointed out the changes in the new library!

Update: September 7, 20
The instructions now state, that the Adafruit_BusIO library is required. Thanks for the hint LightningLion!

What is needed?

For the electronics:
components


1 arduino nano microcontroller or similar
1 OLED display module for arduino with a resolution of 128x64 pixels
some wire
1 9V battery clip (optional)
1 switch (optional)
some heat shrink tube (optional)

tools:
soldering iron
pliers


For programming:
Windows PC
USB cable matching your microcontroller (mini or micro USB)
Arduino IDE
Adafruit GFX library
Adafruit SSD1306 library


Instructions:

Choose the microcontroller
The sets are based on an arduino nano or a similar microcontroller. You can use a cheaper clone as well. They can be purchased in diffferent online shops.
I'm using ones with a micro-USB port to safe a bit of space, but mini-USB ports are totally fine.
They may either come with an ATmega 328P or ATmega 168P microcontroller. The ATmega 328P has more memory, which is required by some of the animations, so I would recommend to get one of them.
If possible try to get one without soldered pin rows.

Choose the OLED display
You'll need a module with an OLED screen. They come in a veriety of sizes, resolutions and colors. There are a few thing to pay attention to, if you want to use my code.
First: the code is written for a display with a resolution of 128x64 pixels, others will not work
Second: there are different interfaces for the communication between the module and the microcontroller. My code supports I2C and SPI.
You can tell the difference by looking at the number of pins on the module. 4 pins is I2C, 7 pins is SPI. Both will work fine.
Third: the OLED modules come with different driver chips. This instruction and the code is made for the SSD1306, which works also for modules with SSD1309. Others like the SH1106 need a different library and are not covered in this tutorial.
Fourth: the set is working with 5V logic, most times you won't find an info on this topic in the product description for the modules, but I just wanted to note that and that 3,3 V logic might not work.
The color and actual size of the module does not matter. A few sizes I used are 0.96", 1.3" (be careful, those came with the SH1106 drivers mostly), 1.54" and 2.42".
If possible, try to get one without soldered pin row.

Additional components
You'll need some isolated wire. Really not important which one. I use double stranded copper wires with 0,14 mm2 each, which is something between 25 and 26 AWG (I think). Those fit nicely inside the pads on the arduino and module.
You can run the set from the USB port on the arduino. Another option shown in this tutorial is to add a 9V clip. You'll need a loose 9V clip, which can be found online or in a electronics DIY store.
If you want, you can also add a power switch of your choice. In that case I recommend to have some shrink tube available as well.


Let's start soldering!
At the beginning you can put these aside, if they aren't already soldered to the boards:

They are not needed. In case they are soldered, you can keep them in place, but they will take place, that's usually limited in a gauntlet.

1. Solder wires to the OLED modules pads. (I like to use different color cables to easily tell them apart.) If your module came with the pins soldered to the board, you may want to remove them first.
I2C


SPI


2. Solder the wires to the correct pads on the arduino (my code uses these pins, you can change them in the code, if you like).

I2C:
GND on the module goes to any GND on the arduino
VCC on the module goes to +5V on the arduino
SCL on the module goes to A5 on the arduino
SDA on the module goes to A4 on the arduino



SPI:
GND on the module goes to any GND on the arduino
VCC on the module goes to +5V on the arduino
SCL on the module goes to D8 on the arduino
SDA on the module goes to D9 on the arduino
RES on the module goes to D10 on the arduino
DC on the module goes to D11 on the arduino
CS on the module goes to D12 on the arduino


Be aware that the pads might be arranged in a different order than on these example modules. Especially check the GND and VCC pads! (My 1.3" OLED modules had them swapped.)

3. Add the 9V clip and switch (optional).
Either connect only the 9V clip to the arduino (red wire to VIN pad on the arduino and black to any GND pad) or place a switch inbetween.
First connect the wires to the switch (about 15cm or 6" should be fine to allow flexible placement in the gauntlet, measure your gauntlet, if unsure).


Connect one of the ends to the red wire of the 9V clip. Use the heat shrink tube to insulate the open wire.



Connect the second open end from the switch to the VIN pad on the arduino. Solder the black wire of the 9V clip to any GND pad on the arduino (I prefer the second option shown below).



Finished!

Now to the programming:
The instructions given here are for a Windows PC, I can't provide any help for other OS. They start at the very beginning in case this is your first arduino project.

1. Get the arduino IDE: https://www.arduino.cc/en/Main/Software
(I use the classic installer, not the app)

2. Install the arduino IDE. I recommend to check the USB drivers and association with .ino files.

3. In case you use a cheap arduino clone, it's most likely that you'll need additional drivers, they use another USB interface: http://wch.cn/downloads/file/5.html
If you are using an original Arduino skip to step 7.

4. Extract the .zip archive (for example with 7zip).

5. Open the folder and run "setup.exe". Simply hit install and wait for it to finish.

6. Restart your computer.

7. Connect the arduino board to your PC (I had trouble using USB 3 ports, USB 2 ports work fine), windows should not say the device isn't recognised, otherwise the drivers were not installed correctly.

8. Open the arduino IDE.

9. In the IDE go to "tools" and search for a line starting with "Board:..." (most likely it will say "Board: Arduino/Genuino Uno". Select "Arduino Nano" instead.

10. Check if under "tools" -> "processor" the "ATmega 328P" is chosen. (If you have an arduino with ATmega 168P, choose this one instead.)

11. Go to "tools" -> "port" and select the port the arduino is connected to. (Even if "COM1" is available it is not the arduino, choose the other one.)

12. If everything went well and there is a second option in the list of ports you can now add the required libraries. Got to "Sketch" -> "include library" -> "manage libraries" a new window will open.

13. You'll need to install three libraries for this code. Enter "adafruit gfx library" in the search bar of the new window, click on the correct list entry (might be the second) and hit install. Do the same for "adafruit SSD1306" and "Adafruit_BusIO" library.

14. Now download the code of your desired animation for the OLED display here: https://drive.google.com/open?id=1cyMBIlov7y7PszwcFf2esufmCnR8Gyil
(please do not share this code anywhere else)

Available animations are:

1. Spinning mythosaur
https://youtu.be/UaMKQuJceV8

2. Targetting computer
https://youtu.be/KZzqlTEB-fM

3. Simple radar
https://youtu.be/Xk2jjG_vfNk

15. Open the code in the arduino IDE ("file" -> "open" or double klick the .ino file)

16. Now you may need to modify it for the communication mode of your module. Identify the correct communication for your display. In case it's I2C, you don't need to change anything, the code is already prepared correctly. For SPI remove any // infront the needed lines and add them to any I2C lines. Have a look at the pictures below, the example is the mythosaur animation, but is the same for all.


17. Click the round button with the check mark in the top row.

18. After a short time the IDE should show "compiling done" (or similar). That's the sign, that everything needed is working and you can now upload the code.

19. Click the button with the arrow pointing right, while your arduino is connected to your PC. Wait until the IDE returns a "done" and indeed you should be done now and have a working set.

In case you are now interested in creating your own animation I can recommend having a look at the adafruit sites for the GFX library, to learn how to do so: https://learn.adafruit.com/adafruit-gfx-graphics-library

« Last Edit: Sep 07, 2020, 11:50 AM by Fi-8015 » Logged
Helmets for Sale in the Trading Station

electriFi - Mando Electronics English / German

Kazya Rembrea


    *
  • *
  • *
  • *
  • 316
  • Keep your wits sharp, and your blade sharper.
Re: electriFi tutorial: build your own OLED display
« Reply #1 on: Mar 06, 2020, 12:42 PM »
Awesome! Can't wait to give this a shot

Logged

Ori Dart


    *
  • *
  • *
  • 451
  • Just some random mir'sheb...
Re: electriFi tutorial: build your own OLED display
« Reply #2 on: Mar 06, 2020, 02:07 PM »
Wow! Thanks for posting this! Very generous of you. Really looking forward to putting some of these together.

Logged
Oya!

Andry         ; )
Re: electriFi tutorial: build your own OLED display
« Reply #3 on: Mar 08, 2020, 06:37 AM »
thanks vod!
I'm definitely going to try this now!
 :like:

Logged

Fi-8015


    *
  • *
  • *
  • 2923
  • Awards 40% increase or more Award for 10 official invasions.
Re: electriFi tutorial: build your own OLED display
« Reply #4 on: Mar 08, 2020, 07:06 AM »
I'm very happy about the positive feedback.
If you encounter any problems following the tutorial, just let me know how I can improve it.

Logged
Helmets for Sale in the Trading Station

electriFi - Mando Electronics English / German

Vorpal


    *
  • 265
Re: electriFi tutorial: build your own OLED display
« Reply #5 on: Mar 08, 2020, 12:41 PM »
You have made my day. Thank you so much. You have just saved me hours f tinkering to get some nowhere near as good as this

Logged
ti his kov'nyn

Fi-8015


    *
  • *
  • *
  • 2923
  • Awards 40% increase or more Award for 10 official invasions.
Re: electriFi tutorial: build your own OLED display
« Reply #6 on: Mar 08, 2020, 05:22 PM »
For me it was a long period of trying and improving as well and I'm very happy that you like the result, but I can totally encourage you to look into writing your own animation too. The guide on the adafruit homepage is really helpful, even if you start at the very beginning with OLEDs.

Logged
Helmets for Sale in the Trading Station

electriFi - Mando Electronics English / German

Kazya Rembrea


    *
  • *
  • *
  • *
  • 316
  • Keep your wits sharp, and your blade sharper.
Re: electriFi tutorial: build your own OLED display
« Reply #7 on: Mar 15, 2020, 07:10 AM »
It's alive!



Although I'm not sure why the top is yellow lol

Logged

Vorpal


    *
  • 265
Re: electriFi tutorial: build your own OLED display
« Reply #8 on: Mar 15, 2020, 07:37 AM »
there are some screen on the market that have a different colour top bar. It might be one of those

Logged
ti his kov'nyn

Kazya Rembrea


    *
  • *
  • *
  • *
  • 316
  • Keep your wits sharp, and your blade sharper.
Re: electriFi tutorial: build your own OLED display
« Reply #9 on: Mar 15, 2020, 07:48 AM »
Ahh... apparently it is, yeah. Was only 6 bucks so no biggie... It actually looks kinda cool with the targeting one loaded though.

Logged

Vorpal


    *
  • 265
Re: electriFi tutorial: build your own OLED display
« Reply #10 on: Mar 15, 2020, 08:03 AM »
Put some red clear plastic over it like from a sweet wrapper. You might loose the top bar as will as making it look even cooler

Logged
ti his kov'nyn

Fi-8015


    *
  • *
  • *
  • 2923
  • Awards 40% increase or more Award for 10 official invasions.
Re: electriFi tutorial: build your own OLED display
« Reply #11 on: Mar 15, 2020, 09:31 AM »
Awesome!
I ordered some off those too, but I'm not sure if I like the seperated top bar. I guess the effect could be better if the animation is designed to better incorporate this separation.
Anyway, I'm happy it was possible to get the display working, following the instructions. Any tips how I could improve the instructions?

Logged
Helmets for Sale in the Trading Station

electriFi - Mando Electronics English / German

Kazya Rembrea


    *
  • *
  • *
  • *
  • 316
  • Keep your wits sharp, and your blade sharper.
Re: electriFi tutorial: build your own OLED display
« Reply #12 on: Mar 15, 2020, 10:35 AM »
No they were actually pretty clear. I just spent the better part of a couple hours converting the Mandalorian font file into a .h file for Adafruit_GFX and figuring out how to get it to work. I might now take advantage of that and see if I can't try to keep it so the text displays on the top bar and the animation displays below but that's gonna be a long process I think lol.

If anyone else wants said font file:
https://drive.google.com/file/d/1yH46GG2-18EHLyOXxc4Toka4F0t0iTZg/view?usp=sharing




Update: Head is spinning but I finally have a text line and static object lol

« Last Edit: Mar 15, 2020, 04:04 PM by Kazya Rembrea » Logged

Kazya Rembrea


    *
  • *
  • *
  • *
  • 316
  • Keep your wits sharp, and your blade sharper.
Re: electriFi tutorial: build your own OLED display
« Reply #13 on: Mar 17, 2020, 05:11 AM »
I am inordinately proud of myself.

https://www.youtube.com/watch?v=_SmyYrxTUVc

The only reason it's so long is because I wanted to capture the dots resetting.

Logged

Fi-8015


    *
  • *
  • *
  • 2923
  • Awards 40% increase or more Award for 10 official invasions.
Re: electriFi tutorial: build your own OLED display
« Reply #14 on: Mar 18, 2020, 03:53 AM »
Awesome!

Logged
Helmets for Sale in the Trading Station

electriFi - Mando Electronics English / German
 


Don't like ads? Help support the Mercs by becoming a Supporter or Auxiliary Member today!
Official Members also get to use the forum ad-free - so kit up and join us!




Powered by EzPortal