Skip to content

8. Electronics Design

This week we had to:

  • Use the test equipment in your lab to observe the operation of a microcontroller circuit board (as a minimum, you should demonstrate the use of a multimeter and oscilloscope)

  • Document your work on the group work page and reflect what you learned on your individual page

This week’s group assignment was led by Onik Babajanyan.

We started by learning some basic components.

Basic Concepts and Components

Onik began the group assignment by reviewing basic concepts in electronics. We looked at what current (I), voltage (U), resistance (R), charge (q) and so on are.

electronic components

We also looked at the basic components of an electrical circuit: resistors, diodes (maybe LED), capacitors, transistors, etc…

Communication Network protocols

Onik also talked about Communication Network Protocols.

Communication

I2C (Inter-Integrated Circuit) is a serial data bus for communicating integrated circuits, using two bidirectional communication lines (SDA and SCL). Used to connect low speed peripheral components to motherboards, embedded systems and mobile phones.

UART (Universal Asynchronous Receiver-Transmitter) is a computing device node designed to organize communication with other digital devices. Converts transmitted data into serial form so that it is possible to transmit it over one physical digital line to another similar device.

Each device that supports UART usually has two pins designated: RX and TX. TX - means transmit (transmit), RX - receive (receive). From here it becomes clear that the RX of one device must be connected to the TX of another. If you connect the RX of one device to the RX of another, both devices will listen to each other, you have connected their inputs.

Oscilloscope PWM

As part of the group assignment, we also examined the PWM signal using an oscilloscope. On the board developed by Elen this week, there is an LED connected to PIN number 0. This pin has PWM capability. We wrote code that in each cycle of the loop() function changes the value from 0 to 255, and when it reaches 255, the value resets to 0. This value controls the brightness of the LED. We wrote the following code:

#define pin2 0
int value = 1;

void setup() {
  pinMode(pin2, OUTPUT);
}

void loop() {
  analogWrite(pin2, value);
  delay(20);
  value++;
  if(value >= 255) value = 0;
}

As a result, we observed that the LED lights up very dimly and gradually becomes brighter and brighter until it reaches its maximum brightness. Then it dims instantly, and the cycle starts over.

We then connected this PIN to the oscilloscope:

And saw the following result:

Logic Analyzer

As part of the group assignment, Onik also decided to demonstrate the operation of a logic analyzer, based on the SUMP compatible logic analyzer for Arduino, which is available on GitHub.

A logic analyzer is a tool used for capturing and analyzing digital signals.

To create the logic analyzer, we used an Arduino UNO, a board made by Areg this week, and an LCD display.

To establish communication between the board and the LCD screen, we used the I2C protocol.

We made connections between the Arduino UNO and the LCD screen to Areg’s board.

logic analyzer 1

We wrote the following code for Areg’s board:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  lcd.init();
  lcd.setBacklight(255); // turn on backlight
}

void loop() {
  lcd.setCursor(0, 0);
  lcd.print("WE ARE HUNGRY");
  delay(1000);
  lcd.setCursor(0, 1);
  lcd.print("VERY HUNGRY");
  delay(1000);
  lcd.setCursor(0, 1);
  lcd.print("");
  delay(1000);
  lcd.setCursor(0, 0);
  lcd.print("");
  delay(1000);
}

And we saw the following on the screen:

logic analyzer 2

We also added the code to the Arduino UNO from the [GitHub repository].

After downloading the program, Onik showed us what the I2C signal looks like:

logic analyzer 3


Last update: June 23, 2024