Introduction: Persistance of Vision #phablabs

About: PHABLABS 4.0 is based on combining the World of Photonics (Science of light and light technologies) with the growing creative ecosystem of existing Fab Labs. The “Photonics Workshops” introduce a variety of fu…

Do you wonder how to write text with LEDs? In this workshop we’ll show you how to do this and use UV LEDs to write a text or images on a phosphorescent surface. The photonics principles used are light absorption and light emission. The different wavelengths of light (visible and non-visible ones) are also introduced.

Properties of this workshop:

Timeplanning: Total: 3-4h

1. Introduction about the theoretical photonics background: 15 minutes
2. Electronics parts: 95 minutes
3. Mechanics parts: 60 minutes
4. Software: 30 minutes
5. End of workshop: 10 minutes

Target audience: Young Professionals (18+ years old)

DISCLAIMER: By using this information you agree to be legally bound by these terms, which shall take effect immediately on your first use of the information. PHABLABS 4.0 consortium and its member organizations give no warranty that the provided information is accurate, up-to-date or complete. You are responsible for independently verifying the information. VUB cannot be held liable for any loss or damage that may arise directly or indirectly from the use of or reliance on the information and/or products provided. PHABLABS 4.0 consortium and its member organizations disclaim all responsibility to the maximum extent possible under applicable laws: All express or implied warranties in relation to the information and your use of it are excluded. All liability, including for negligence, to you arising directly or indirectly in connection with the information or from your use of it is excluded. This instruction is published under the Creative Commons licence CC-BY-NC.

Step 1: Principle of the Phosporescent Persistance of Vision

In photo 1 you can see the first prototype of the workshop ‘Persistence of Vision’. What we need to make a text we are writing with LEDs visible is a rotating drum, coated with a phosphorescent film and illuminated from the inside with light. The rotational speed of the drum corresponds approximately to the re-emission time of the phosphorescent film and thus a new text or image can be displayed for each new rotation of the drum. The construction of the prototype shall be used as a model and inspiration for developing further displays and forms to write with LEDs.

Emission is the process where a substance gives off or emits radiation when it is heated or treated chemically. The level of emission of a substance depends on its spectroscopic composition and temperature.

Absorption is the process where the electrons of a substance absorb or take up the energy wavelengths incident on them. The atomic and molecular structure of the material governs its level of absorption, along with the amount of electromagnetic radiation, temperature, solid crystal structure, and intermolecular interactions.

Phosphorescence is a kind of photoluminescence (i.e., a kind of light emission of a medium) which lasts relatively long after excitation of the medium. The excitation energy is stored in metastable electronic states (often triplet states), exhibiting only forbidden transitions to lower states. The stored energy can be released only through relatively slow processes, which are often thermally activated. In short, phosphorescence is a phenomenon in which an object absorbs light energy and gradually releases it, even after the original light source is removed.

Different types of lights will affect how much energy is able to be stored in a phosphorescent object. Infrared light waves have less energy than ultraviolet light waves. Because of this, infrared light will not “charge” the object as well as ultraviolet light. Although incandescent and fluorescent lights both look white, the individual colors in them are different. Incandescent light bulbs emit visible light with a large percentage of infrared light. Fluorescent lights emit visible light with some ultraviolet light mixed in.

Important phosphorescent materials are phosphorus, europium-doped strontium aluminate (Eu:SrAl2O4) and zinc sulfide (ZnS). They are used e.g. in safety products such as exit signs, which are visible even under conditions of power failure.

Please see here for a more advanced explanation of the theoretical background:
https://www.tf.uni-kiel.de/matwis/amat/semi_en/kap...

LEDs

A light-emitting diode (LED) photo 3 is a semiconductor light source that emits light when current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form of photons. This effect is called electroluminescence. The color of the light (corresponding to the energy of the photons) is determined by the energy required for electrons to cross the band gap of the semiconductor. White light is obtained by using multiple semiconductors or a layer of light-emitting phosphor on the semiconductor device.

LEDs have many advantages over incandescent light sources, including lower energy consumption, longer lifetime, improved physical robustness, smaller size, and faster switching. Light-emitting diodes are used in applications as diverse as aviation lighting, automotive headlamps, advertising, general lighting, traffic signals, camera flashes, lighted wallpaper and medical devices.

Unlike a laser, the color of light emitted from an LED is neither coherent nor monochromatic, but the spectrum is narrow with respect to human vision, and functionally monochromatic.

Theoretical background LEDs: http://www.explainthatstuff.com/diodes.html

Step 2: Part List

Photonics parts:

*8 x LED, 3mm, ultra-bright, colourless, clear blue photo 1
*Glow in the dark tape: 30-50mm wide, length: 50 cm

Other parts:

*1 PCB (Gerber file attached)
*1 Wemos D1 min- ESP8266 photo 2
*1 Stepper motor 28BYJ48 photo 3
*1 LED-driver, Texas Instruments TLC5916IN or TLC5917IN photo 4
*3 multilayer ceramic capacitor 100nF, 2,5mm pin spacing photo 5
*1 electrolyte capacitor, radial, 100 mciro-Farad, >5V, 10mm, 3,5 pin spacing photo 6
*1 metal oxide film resistor 820 Ohm photo 7
*1 USB 2.0 cable, Hi-Speed A connector to B connector photo 8
*1 IC socket, 16-pin, double spring contact, 16 pol photo 9
*1 JST XH 5 pin multiple connector - pin header, straight photo 10
*1 KG socket photo 11

Tools (for example in Fab Labs):

*lasercutter
*Soldering iron
*wood glue
*wire cutter
*Laptop for the software installation/programming of the Wemos

Don't find the material you are looking for? Via this link you could buy all the photonics material needed for this workshop. http://b-photonics.eu/photonics-toolkit/general-p...

Step 3: Preparations Upfront

Laser cutted parts:(files attached)

It is advised to prepare the laser cutted parts (photo 1) before the workshop and sort the different parts.

You should have the following laser cutted parts:

The holder, on which the rotating drum will be placed is a round wood plate with an adjacent wooden box, in which the electronics will be placed.
The box consists of 8 different parts (see photo 2), which will be stuck into the corresponding fixture that is adjusted to the round wood plate.(photo 3)
It’s recommended to cut out the wooden parts with the laser cutter beforehand and demonstrate the laser cutter by cutting out another set of the parts, which can be used at another workshop.

Software:

In order to save time, the software should be installed before onto the WeMos. Photo 4
In this workshop a WeMos D1 mini will be used as controller. Here you can find some product details about this controller: https://wiki.wemos.cc/products:d1:d1_mini

General idea
The WeMos D1 mini is based on an ArduinoIDE compatible ESP8266 (ESP) controller with 4Mbit Flash and WiFi aerial to connect to a Wi-Fi network and thus to provide Internet or browser access. For programming and power supply, a micro USB socket is available.

The basic idea is a constantly running web server on the ESP, which is responsible for the communication with the application (here the UV LED control) as well as for the configuration of the WLAN. The software was developed in the Arduino IDE and can be customised or simply flashed as a .HEX firmware file on the ESP. In order to obtain less blocking communication it was tried to us asynchronous UDP and TCP libraries. The function of the ACE editor contained in the ESPAsyncWebServer package has been modified allowing it can be stored completely in the memory of the ESP and is therefore also available in AP mode. The same should apply for an adaptation of a graphical programming option that passes through ESP functions according to Javascript.

Components
For programming purposes, an Arduino development environment (version 1.8.5 recommended, version 1.0, for example found on Ubuntu 16.04, is too old) and ESP8266 customization is needed. The asynchronous libraries used require at least version 2.3 of the ESP tool, which can be installed either via the board manager or directly as [GIT version] (https://github.com/esp8266/Arduino#using-git-version).

In addition, the Arduino IDE still needs to be added to the ESP Upload Manager. This will give the IDE another option under the Tools menu item: "ESP8266 Sketch Data Upload". The upload manager converts all files from a subdirectory named "data" into a SPIFFS file system and loads them into the second, 3MB, FLASH area of the WeMos D1 mini.

The ESP Exception Stack Decoder extension is helpful for debugging, as it can be used to determine where something goes wrong when a hexadecimal stack dump is displayed in the terminal window during debugging.

Further instruction can be found here: https://wiki.wemos.cc/tutorials:get_started:get_s...

Libraries
The following library from Github was patched for the project. The patched library is located in the "libraries" folder of this repository and must be moved or copied to the libraries folder of the Arduino environment before compiling. See also: Manual installation of libraries

· Timelib.h

Under non case-sensitive systems (Windows, Mac), error messages often occur with the Time library when the library is integrated as Time.h. Numerous other libraries bring along header files in time.h notation. Therefore, it is advised to install this library in a Timelib directory and to include the Timelib.h directly as well. The Time.h contained in the project for backward compatibility reasons has no other function.

In addition to the existing Arduino and ESP standard libraries, the following libraries from Github repositories are used without modification. These can either be installed via "git clone" into the local library directory, or downloaded as a ZIP file and then installed as ZIPFILE.

ESPAsyncUDP.h
ESPAsyncTCP.h
ESPAsyncWebServer.h
Timezone.h

Compiling and loading the program
Downloading the program code or clones of the Github repository
Installing the described components into the Arduino IDE
*ESP8266 Toolchain (either via the boardadministrator oder directly via Github
*Installation of ESP Sketch Data Upload-Tools
*Optional: ESP Exception Stack Decoder
*ESPAsyncUDP.h
*ESPAsyncTCP.h
*Timezone.h
Installation of patched Timelib into library directory
*Open the file PHABLABS-POV.ino in the Arduino IDE
*Make the following settings for the board:
*Lolin (Wemos) D1 R2 & mini
*Flash Size: 4M (3M SPIFFS)
*Debug Port: Serial
*Erase Flash: All Flash Contents
*COM-Port: aktuellen COM-Port des angesteckten WeMOS D1
Compile the program and load it onto the controller.
*Load the contents of the SPIFFS file system onto the controller using the menu item: Tools=> ESP8266 Sketch Data Upload.
*To upload the Erase Flash program code again, set it back to Only Sketch. This preserves the SPIFFS file system and any saved configuration data.

Connecting to the ESP
The ESP is currently starting in AP mode and can be reached via the SSID name ESPMATRIX stored in the source code and the password ABCdef123456. If the ESP already has the access information for a currently accessible WLAN stored (for example, because another sketch was previously loaded), so he connects there! In all cases, the LED matrix then indicates the IP address under which the ESP can be reached. If the ESP can’t be programmed or if there are problems connecting to WLANs, it is advisable to first completely erase the ESP. This is done with the esptool.py:

python path/to/esptool.py --port COMPORTNAME erase_flash

This may also be necessary with newly purchased modules, as these are sometimes delivered with incompatible structure of the memory structures to the Arduino IDE. The Arduino IDE writes only in the first memory block, assuming a standard layout! On the one hand, this makes sense because it does not touch the contents of the other memory areas, but it can cause problems if these areas are not as laid out or filled as the IDE or the sketch expects! Once connected to the ESP, there are these important URLs:

*/content: Allows content, brightness and speed of the text to be set. Time and date are currently only up to date if the ESP is located as a client in a WLAN and reaches an NTP server (de.pool.ntp.org photo 5)
* /graphicsEditor.html: Allows to edit graphic content:
* /wificonnectAP: Allows the ESP to connect to an existing WLAN as a client.
* /wificonfigAP: Allows to change SSID and password for the AP mode, as well as the password for the administration account (default admin / admin).
* /wifiRestartAP: Deletes the saved WLAN client access data and starts in AP mode
* /edit: Starts the built-in ACE editor to edit the files stored on the SPIFFS. It is now essential for the editor that the content of the data subdirectory is loaded to the SPIFFS using the ESP upload manager described above. Otherwise, the Javascript files are not found!

Step 4: Soldering of the PCB

Since the electronics part of the workshop is the most time-consuming, it is advised to start with this part of the workshop.

Before soldering, the participants should be asked if they have already soldered and how well they can do it. Even if the participants have a lot of soldering experience, the principle of soldering should be explained with an easy example, to make sure that everyone is more or less on the same level.

See here for helpful instructions: http://www.riccardobevilacqua.com/SolderingSafety.pdf

The electronics on photo 1 & 2 are needed to solder on the PCB.

1. Solder the resistors onto the PCB: R1 Photo 3
Hold the resistor with pincers and place them on the correct position on the PCB, this makes it easier to solder those small parts.

2. Solder the the 100nF-capacitors onto to board: C1, C2, C3 After these two steps, your PCB should look like photo 4

3. Next insert LED 1 to 8 > but on the other side of the PCB (different, than it is labelled on the PCB. The LEDs are the only components that will be inserted on the other side of the PCB. Please also pay attention to the plus and minus pole of the LEDs. To differentiate the plus from the minus pole there is a simple trick: The plus pole always has the longer stick than the minus pole. The plus pole needs to be inserted towards the edge of the PCB. Make sure, that the LEDs are fully inserted to the ground of the PCB. To make sure, that the LEDs are fully inserted, you can use the wood part with the fixture for the LEDs (photo 5) and press it towards the inserted LEDs. When you have inserted all LEDS carefully turn them around, holding them with a finger and solder them onto the board. Shorten the protruding parts with a wire cutter. Photo 6

4. Solder on the DIP-sokcet IC1 and IC2. Please note that the notch is showing to the right direction. First solder one pin onto the board or 2 opposite ones and check if they are soldered on the board correctly before soldering on the remaining pins. (The image on the right does not include the already soldered on LEDs, which is a mistake). Photo 7

5. Now solder on the JST-XH plug, where the 5 pin motor will be placed on. Please note: The layout of the PCB is wrong in this case. Other than marked on the PCB, turn the plug 180 degrees and make sure, that the pins are showing towards the PCB and the empty part of the casing towards the edge of the PCB.

6. Next insert the electrolytic capacitor C4 into the corresponding place marked on the PCB: The capacitor has a plus and a minus pole, make sure that the capacitor is inserted correctly and as marked on the PCB. The plus pole is the side with the longer stick. Photo 8

7. Insert the connector for the WeMos microcontroller onto the PCB. Stick the WeMos onto the connector and make sure that the antenna and USB connector is on the upper side of the PCB. Then solder the WeMos onto the PCB. Photo 9, 10, 11 & 12

8. Take the motor driver ULN2003 and lay it flat on the table in order to carefully bent the pins and insert all legs into contact holes of the socket. The ULN has to be inserted below the white JST-XH plug. Photo 13
Then take the LED driver TLC5916 (photo 14) and insert it next to the Wemos. Make sure to also bent the pins a little bit, which simplifies the inserting into the contact holes.

The PCB should be checked by the workshop instructor, to make sure, that there are no major soldering mistakes.

9.Now the motor can be put into the JST-XH plug. Photo 15. Then connect the USB cable onto the Wemos D1 mini and provide the USB cable with power. Photo 16.

If the PCB was soldered correctly, the LEDs should blink now. The electronics part of the workshop is now finished. We’ll continue with the mechanics. Photo 17

Step 5: Mechanics

1. Tape the glow-in-the-dark tape outside around the plastic circle. Glue the ring into the plastic cover and then the circle. Photo 1

2. Connect the finished PCB onto the base plate, but first stick the wood plate onto theLEDs.

3. Put together the case of the PCP and pass the cable through the small slot.

4. Plug the motor mount with the small side towards the center of the circle onto the base plate. Photo 2

5. Insert the motor into the motor mount and cover it with the plastic cover.

6. If necessary glue the wooden parts together with wood glue. Photo 3

Step 6: Software

Since we have completed now the electronics and mechanics part of the workshop we can now put our “Persistence of Vision” into operation. Thus, we need to update our software on the Wemos now.

- Enter the following Board-administrator URL in the Arduino IDE unter file/default
http://arduino.esp8266.com/stable/package_esp8266c...
- Search for „esp8266“ under tools/boards/board administration and install the module with version 2.4.1.
- Load the following software from Github: https://github.com/fablab-ka/PHABLABS-POV

*Copy the content of the subfolder libraries to /home/$user/Arduino/libraries
*Select the option „Wemos D1 R2&mini“ in the Arduino-IDE under tools/board
*compile the sketch with [ctrl]+[R] – this can take up to one minute.
*Follow the instructions on Github.
*With the programme, provided by Fablab Karlrsuhe you can now edit the text/graphic on the rotating display at your discretion.

Photo 1-4

Step 7: Conclusions

What we learned?

- principle of light absorption and light emission
- Interplay of LEDs and glow-in-the dark foil
- how does a LED work
- programming of Wemos mini controller

ABOUT PHABLABS 4.0 EUROPEAN PROJECT

PHABLABS 4.0 is a European project where two major trends are combined into one powerful and ambitious innovation pathway for digitization of European industry: On the one hand the growing awareness of photonics as an important innovation driver and a key enabling technology towards a better society, and on the other hand the exploding network of vibrant Fab Labs where next-generation practical skills-based learning using KETs is core but where photonics is currently lacking. www.PHABLABS.eu

This workshop was set up by Fablab Karlsruhe in close collaboration with Steinbeis 2i GmbH.