Week 09 - Output Devices

The goal of this week's assignment is to use an output device with a microcontroller on a board that we have designed.

Individual assignment:

For this work we will use a new design that is a variation of the one used in week 08, it is a plate in the shape of Grogu but with an Attiny412 microcontroller and it is programmed via UPDI.

Figure N°1

Figure N°2

We repeat the process carried out in week 8, milling the plate and cutting the contour.

Figure N°3

Next we apply the anti-solder mask.

Figure N°4

We engrave the board with the laser cutter.

Video N°1

And this is the result.

Figure N°5

Them we solder the components to the board.

Figure N°6

To program via UPDI we follow the following steps:

  1. Open the Arduino IDE and go to "File" -> "Preferences". In the "Additional card URLs manager" section, add the following URL: http://drazzy.com/package_drazzy.com_index.json
  2. Search for "ATTinyCore by SpenceKonde" and install the latest version.
  3. Open the Arduino IDE and select your ATtiny412 board from the "Tools" > "Board" menu.
  4. Choose the "jtag2updi" programmer tool from the "Tools" > "Programmer" menu.
  5. Connect your UPDI programmer to your computer and select it from the "Tools" > "Port" menu.
  6. Upload your code to the ATtiny412 by clicking "Upload using Programmer" or by pressing "Shift + Ctrl + U".

The programmer we will use for this task is an Arduino Uno board.

Figure N°7

This would be the connection diagram between the UPDI programmer and the pcb.

Figure N°8

We upload the classic Blink example to the board and see Grogu's hand blink.

Video N°2

In the same way we put a case that is shaped like his clothes.

Video N°3

Now we must place the output device on our custom PCB board, it will be a 20x04 LCD with an I2C adapter.

Figure N°9

The script to be used is similar to the examples of the "LiquidCrystal_I2C" library.

It is important to mention that each LCD screen has a hexadecimal address, for a 20x04 LCD the "0x27" is used.

Following the Star Wars theme, we will put a phrase on the LCD screen in the first lines of the LCD, additionally a small face that looks like grogu will be made.

Script 01 - LCD
                    
                        #include <Wire.h> 
                        #include <LiquidCrystal_I2C.h>
                        
                        LiquidCrystal_I2C lcd(0x27,20,4); 
                        
                        void setup()
                        {
                          lcd.init();                     
                          lcd.init();
                          
                          lcd.backlight();
                          lcd.setCursor(7,0);
                          lcd.print("May the force");
                          lcd.setCursor(9,1);
                          lcd.print("be with you ");
                          lcd.setCursor(2,1);
                          lcd.print("^ ^");
                          lcd.setCursor(1,2);
                          lcd.print("(o_o)");
                          lcd.setCursor(2,3);
                          lcd.print("Fab Academy 2023");
                        }
                        
                        
                        void loop()
                        {
                          digitalWrite(LED_BUILTIN, HIGH);   
                          delay(100);                   
                          digitalWrite(LED_BUILTIN, LOW);  
                          delay(100); 
                        }
                    
                  

This is how the implementation looks.

Figure N°10

And this is the message displayed.

Figure N°11

Group assignment:

For the group work we have to measure how much current our output device is consuming.

We are going to do 2 tests, one with the LCD screen and another without it, we will use a stationary power supply since the current taken by the PCB is shown.

Figure N°11

In the first test we see that the consumption of the board alone is 0.02 A or 20 milliamps (mA).

Video N°4

In the second test we repeat the same action but with the LCD screen connected to the microcontroller, showing that in this test the consumption is 0.07 Amps or 70 milliamps.

Figure N°12

Video N°5

With these two tests we see that the difference in current between the two is 50 milliamps, so that is the consumption of our output device.

Final thoughts:

  • I had never programmed a microcontroller via UDPI before, it seemed quite simple compared to other workflows.
  • Attiny412 is a pretty powerful microcontroller with all the necessary peripherals for complex projects, the only limitation I find is the number of pins.
  • Measuring current using this stationary power supply is not the most direct method of doing it but unfortunately in our laboratory the ammeters of the multimeters were not working.

The files created or used this week can be downloaded here:

Grogu PCB v2 with AtTiny412 - Kicad Files Link
Grogu PCB v2 with AtTiny412 - traces Link
Grogu PCB v2 with AtTiny412 - outline Link
Grogu PCB v2 with AtTiny412 - mask Link
Script LCD 20x04 Link