Translate

Monday, April 6, 2020

How to sterilize corona virus masks


Introduction
First of all, I want to reiterate that I am not responsible for what I will expose in this article, it is just an idea that came to me reading that ultraviolet rays alter the DNA of viruses and make them harmless. To have a scientific validity it is necessary to know other information such as the intensity of UV radiation and the exposure time necessary to eliminate them. In these times of forced isolation, I thought of reusing the lamp of an old eprom (Erasable Programmable Read-Only Memory) eraser that I had at home. These non-volatile memory chips had a fused quartz window to erase them by exposing them to a special ultraviolet lamp for a few tens of minutes.

The lamp
The recommended exposure time for eproms was 20-30 minutes with a UV lamp with a wavelength of 253.7 nm with an intensity of at least 15W / cm2 and at a distance of approximately 2.5 cm.
The lamp of my eraser, shown in figure 1, may have similar characteristics.
Figure 1
It is a transparent fluorescent tube, having no internal phosphor coating, with a power of 6W. The lamp housing is made of fused quartz or Vycor as the common glass filters UVC rays. The efficiency is around 30-40%, which means that the effective radiated power is at most 2.4W so it is necessary to use an aluminum reflector to put under the lamp, as seen in the prototype photos. Even a thin sheet of aluminum, like the one used in the kitchen, acts very well as a reflector.
As you can see from the photo, the lamp has the writing "GERMICIDAL" G6T5 GL-6. It is not difficult to find them on the market because they are widely used for disinfection of air and water. Philips also produces several lamps with a wavelength of 253.7 nm (UVC) from the TUV TL series. The cost is less than 10 €.
Warning, UVC lamps are very harmful to the eyes and skin, therefore all precautions must be taken, as I did in my project.
The lamp, like all fluorescent tubes, requires a ballast suitable for its power and a starter.
A tanning lamp (UVA) is not good or, in any case, does not have the same effectiveness.
Even the black fluorescent tubes, coated with special phosphors that filter the visible light (> 400 nm), emit UVA radiation.

Germicidal lamps made with UVC led arrays are also on the market, but these are of higher wavelength (265-290 nm). From what I have seen in the datasheets, these LEDs have not high powers and low efficiency (10%), therefore different ones are needed and they are also quite expensive.

My realization
I made my system with what I had at home. I disassembled the lamp, ballast, starter and timer from the old eraser and mounted them in a suitably sized aluminum cabinet, as seen in the images in figure 2.


Figure 2

On the bottom right side I mounted a micro-switch to turn off the lamp when the cover is open, as seen in figure 3. The timer used is mechanical.
Figure 3

Of course you could make this system in better ways, perhaps by inserting a support for the mask, but I made it with what I had at home.
The green light that can be seen at the top acts as a simple slide, lights up with the light of the lamp and indicates that it is working.
The scheme is shown in figure 4.
Figure 4

Parts list
  • 6W UVC lamp (254 nm) Philips TUV TL or Osram HNS 6 W G5 or compatible.
        2 lamp holders with G5 socket.
        Starter complete with 6-9W ballast or electronic ballast.
        Micro-switch.
        0.5 A fuse and fuse holder.
        Double switch, power cord with earth.
        1-5 minutes electronic or mechanical timer.
        25x15x10 cm aluminum case.
        21x12 cm aluminum reflector, 4 + 4 + 4 cm folded (trapezoidal section).


References
1.       “Ultraviolet”, https://en.wikipedia.org/wiki/Ultraviolet
2.       “Philips TUV TL Mini”,

3.       “HNS 6 W G5, PURITEC HNS UV-C”, OSRAM GmbH, April 17, 2020

Wednesday, April 1, 2020

A DIP switch for Arduino

How to read a quad dip switch with only one analog pin with Arduino

The DIP switch is a set of small switches in a Dual In-line Package. It finds numerous applications, such as address configurator, select a type of operation, enter a remote control code.

Normally the dip switches require as many digital input pins as there are dip switches used and also with pull-up resistors enabled. In the proposed circuit I use only one analog input for four dip switches.

This article is also particularly useful for applications with ESP8266 which has few I/O pins but has an analog input with a full-scale of 1V.

After developing a project to read a 4x3 keypad with three analog inputs [1], I was thinking of applying this methodology to dip switches too but things are not at all similar. The buttons close only one at a time and are monostable while the dip are bistable and also can close all together.
After several attempts, simulated at computer, I arrived at the synthesis of the circuit shown in figure 1.
Figure 1
In theory, the values of the R1-R4 resistors should be 1, 2, 4, 8 kΩ, but even with the standard values I used, good results are obtained. If we measure the resistance between Vo and Gnd, we have a value that is proportional to the binary number set, but the Vo voltage will be equal to:
Vo = Vcc*R14/(R5+R14)
Where with R14 I indicated the sum of the resistors R1 to R4 not short-circuited by the dip switches. As can be seen, now the law is not linear, but it suffices to put R5 large enough to minimize the current variation. This will reduce the output voltage, but by setting the Arduino reference voltage as "INTERNAL" we get a full-scale Arduino UNO ADC converter equal to about 1.1V.
Indicating with "ON" the closed switches and with "OFF" the open ones and setting Vcc = 5V the following table is obtained.
D4
D3
D2
D1
N
R14
I [mA]
Vo [mV]
DV [mV]
NADC
DN
NADC_L
NADC_H
ON
ON
ON
ON
0
0
0.073
0.00
0
0
0
0
30
ON
ON
ON
OFF
1
1000
0.072
72.36
72.36
67
67
47
87
ON
ON
OFF
ON
2
2000
0.071
142.65
70.29
133
66
113
153
ON
ON
OFF
OFF
3
3000
0.070
210.97
68.32
196
63
176
216
ON
OFF
ON
ON
4
3920
0.069
272.15
61.18
253
57
233
273
ON
OFF
ON
OFF
5
4920
0.068
336.89
64.75
313
60
293
333
ON
OFF
OFF
ON
6
5920
0.068
399.89
63.00
372
59
352
392
ON
OFF
OFF
OFF
7
6920
0.067
461.21
61.32
429
57
409
449
OFF
ON
ON
ON
8
8200
0.066
537.35
76.14
500
71
480
520
OFF
ON
ON
OFF
9
9200
0.065
595.08
57.73
553
53
533
573
OFF
ON
OFF
ON
10
10200
0.064
651.34
56.26
606
53
586
626
OFF
ON
OFF
OFF
11
11200
0.063
706.18
54.84
657
51
637
677
OFF
OFF
ON
ON
12
12120
0.062
755.42
49.24
703
46
683
723
OFF
OFF
ON
OFF
13
13120
0.062
807.68
52.26
751
48
731
771
OFF
OFF
OFF
ON
14
14120
0.061
858.67
50.99
799
48
779
819
OFF
OFF
OFF
OFF
15
15120
0.060
908.44
49.76
845
46
825
865
Where NADC is the output number of the 10-bit ADC converter. With four dip we represent 2^4 = 16 different states that must be identified precisely. The program must discriminate each state with two thresholds NADC_L (lower) and NADC_H (upper). The number of 10 bits, at the converter output, must be between these two limits which I determined with ± 20 units with respect to the NADC value. The diagram in figure 2 clearly shows the intervals and the output voltage Vo as a function of the number set on the four dip.
Figure 2
As can be seen, the trend is fairly linear and the intervals DN range from a minimum of 46 to a maximum of 71, so the thresholds of ± 20 do not overlap.
As shown in the table, by powering the circuit with Vcc = 5V, the maximum output voltage is 908.44 mV, lower than the maximum voltage (1100 mV) accepted by the converter.
If you need an 8-pin dip switch, just duplicate the circuit and use a second analog input. Figure 3 shows a connection diagram of the individual components.
Figure 3

The circuit is realized with few soldered joints and it is also easy to draw the printed circuit. Figure 4 shows the appearance of my prototype seen from the component side and from the soldered side. I used a small perforated circuit board of about 40x30 mm.
I have optimized the circuit for Arduino / Genuino Uno and the program is fine for MCU type ATmega328 / 168. But it can also be used, with minor modifications, with other MCUs, such as SAMD21G18 mounted on Arduino Zero and Arduino MKR1000 boards and also ESP8266 and 32.
Figure 4
I used a 3-pin strip connector for wiring with Arduino. The resistors must have a low tolerance, I used those with 1/4W metal film with a tolerance of ± 1%, very common and easy to find. Figure 5 shows the wiring between the DIP card and Arduino Uno.
Figure 5

List of components
component
description
component
description
R1
1 kW ± 1% metal film
R5
68.1 kW ± 1% metal film
R2
2 kW ± 1% s metal film
-
0.1” perforated circuit board
R3
3.92 kW ± 1% metal film
-
3 pin strip connector
R4
8.2 kW ± 1% metal film
Dip4
DIP switch with 4 positions

The program
The sketch is an example of use of the circuit and provides both the number and the individual dip arranged in the DipSw char array. In this example I use Arduino Uno's pin A0 as an analogue input and in the setup I insert the analogReference (INTERNAL) instruction to set the internal Vref at 1.1V, more stable and less noisy than the default at 5V.
In the loop () function I set the discrimination to thresholds and in the readDIP function (byte mybyte) I create the array of characters ordered as the dip switches. This last function is useful to use every single switch.

/* program DIP4to1.ino
 *  only one analog input for 4 dip switches
 *  Giovanni Carrera - 20/08/2019
 */
int DipPin = A0;// DIP4 analog input
// limits of DIP4 output values:
const int NADC_L[16] = {0,47,113,176,233,293,352,409,480,533,586,637,683,731,779,825};
const int NADC_H[16] = {30,87,153,216,273,333,392,449,520,573,626,677,723,771,819,865};
char DipSw[5];

void setup(){
 analogReference(INTERNAL); // internal ADC reference input = 1100V
 Serial.begin(115200); // used with serial monitor
}

void loop() {
  int val = analogRead(DipPin);// read analog keyboard
  for (int i=0; i < 16; i++){
     if (val >= NADC_L[i] && val <= NADC_H[i]){// has found the right value
        Serial.print(val);
        Serial.print(" , N = ");
        Serial.print(i);
        Serial.print(" , Dip = ");
        readDIP(i);
        Serial.println(DipSw);
        break;
     }
  }
  delay(500); 
}

void readDIP(byte mybyte){
 byte mask = 0x01;
 for(int i=3; i >= 0; --i){
   if(mask & mybyte)
       DipSw[i]= '1';
   else
       DipSw[i]= '0';
   mask <<= 1;
 }
}

References
1.      “Very few wires for a numeric keypad for Arduino”, Giovanni Carrera, 10/11/18, http://ardupiclab.blogspot.it
2.       “Only Three Pins for a 4x3 Keypad”, Giovanni Carrera,  November 19, 2018, https://www.hackster.io