Electrical

Electrical Design

This Operator needs to use two servos, sixteen photoresistors, sixteen LEDs, five buttons, a laser, an LCD display, and a seven segment display. The microcontroller used will be the Arduino MEGA, and the ESP32 Development Version. The current is expected to spike at times which intuitively exceeds the maximum possible current that is provided by the MEGA.

Standby Operator

Targets - Circuit

4x4 Photoresistor Matrix

This is the photoresistor and the constant resistor in series. In the previous image, we assume that the lighting is bright enough such that the resistance across the photoresistor is 10k Ohms making the total resistance be 20k Ohms. This will supply a current without the laser of 0.25mA and since there are 16 of them, there will be 4 mA of current across these resistors. The leakage current for each analog input will still be two magnitudes smaller than the current flowing across the resistors making this the perfect configuration. If we assume that the resistance across the photoresistor may reach 0 Ohms, there will still be a resistance of 10k Ohms which will supply a total current 8mA.

4x4 LED Matrix

These are LEDs in parallel as position indicators powered from digital output ports. In the previous image we can see 16 LED’s in parallel. Each LED will have a maximum of 20mA across. We did not want to tinker with the specific resistance for each LED since that will only complicate the system more. In this configuration, we will need to supply the 20 mA, 6 times since we only want to indicate the position of the targets which we will limit to 6. The total current flowing across the LEDs will be 120mA. This alone calls for an external power supply since this is expected to approach the limit of the Arduino.

Simulating the Circuit

Simulating the Circuit

In the previous figure, we have the maximum expected value for the circuit at the moment. Since we still need to power the two servos and the laser which is less than 20 mA, we will need to draw significantly more current. The servos are meant to be powered by this microcontroller, but running everything directly from the arduino is surely going to decrease the brightness (the current flow) of the 16 LED indicators.



Giving Directions

Button with Internal Pull-Up Resistors

In this image we show all of the digital output pins that will power the LEDs. For this design, we decided to only have 6 LED’s turn on and the current flow has already been determined. In this case, this is completely fine to have.

Power Supply

This image shows one of the power supplies for simulation purposes, but they may be redistributed as needed.

Building the Circuit

4x4 LED Matrix

In this image we use decided to have groups of four for each color. Each LED is in series with a 220 Ohm resistor and powered by a digital output pin. The first digital pin begins on pin 22 and continues from top to bottom and left to right. The last pin is on pin 37 which accounts for the bottom right LED.

4x4 Photoresistor Matrix

For this circuit, we have all of the photoresistors spaced out by an inch from each other. Each photoresistor is in series with a 10 kiloohm resistor. As the light intensity is increased on the photoresistor, the resistance is decreased. Since the photoresistor is adjacent to the power source, we need to determine the times when the voltage increases by a significant amount.

Giving Directions

In this figure we have five buttons that are all labeled. The top, bottom, left, and right buttons are all digital inputs that are initialized sequentially beginning from pin 38 and ending on pin 41. Pin 42 is reserved for the enter button which is the rightmost button. All buttons are initialized with the internal pull-up resistors of the Arduino which are expected to be 20 Kiloohms per push button.

Analog Pins

We needed to use all sixteen analog pins on the Arduino MEGA. Pin A0 to A4 refers to the four reference voltages for the top row of photoresistors. The pattern for the analog pins is A(4*r+c) where 'r' refers to the row number and c refers to the column number. The row and column numbers have a range of 0 to 3 each.

Intercommunication Lines

In this image we can see pins 1 and 19 are used for communication between the Arduino MEGA and the ESP32. In later updates, they were updated to use pins 18 and 19 for consistency and control over the communication lines.

ESP32 MQTT Server Communication

This ESP32 is communicating with the Arduino. The ESP32 supports 3.3 volts for communication so we made a quick voltage divider circuit that consists of a 2 kiloohm resistor and a 1 kiloohm resistor. The voltage output from the Arduino MEGA is 5 volts which is dropped down to approximately 3.333 volts. Both microcontrollers are communicating through UART and the ESP32 is communicating to an MQTT server.

7 Segment Display and LCD display:

The following image shows the configuration for the 7 Segment Display and the LCD display.

Controlling the LCD display:

The following configuration are the hidden resistors used to control the contrast and the current flow of the LCD.

A glimpse on the inside:

This image just shows how how we needed to manage many cables to work for one container.

Internal control of the 7 segment display:

This image shows the 220 Ohm resistors that are attached to the seven segment display.

Note: Some of these physical configurations were updated as the experiment progressed.

Main Schematic

In this image we show the ESP32, the Arduino Mega, the sixteen photoresistors, the sixteen LEDs, the five buttons, the seven segment display and the shift register used, and the LCD display.

ESP32 Dev Module

The ESP32 Development board is used to communicate with the MQTT server.

Sixteen LEDs configuration:

This image shows the sixteen LEDs in series with a 220 Ohm resistor.

Sixteen Photoresistors:

The 16 Photoresistors are used in series with a 10 Kiloohm resistor.

Five Button Inputs:

These are the buttons that I will use and their respective connections.

Seven Segment display configuration:

This image shows the configuration between the seven segment display and the shift register. Each LED is in series with a 220 Ohm resistor. More information over where the shift register is connected could be found on the coding section.

LCD Display:

This image shows the configuration of the LCD and the Arduino MEGA. There is an extra resistor and potentiometer used to control the current flow into the LCD display and control the contrast with the potentiometer.

Note: Some of these physical configurations and schematics were updated as the experiment progressed. With some modifications to the code, an experienced user may be able to replicate the experiment.

Master Operator

Sensors and Feedback Devices Used

LCD Display:

LCD is used to see current laser commands, targets

10 Kilo-Ohm Potentiometers:

Potentiometers used to change row, column position commands

Motor Rotor:

The motor is used as feedback for when the MPU or PIR sensors are triggered.

MPU 6050:

MPU sensor is used to check for acceleration along various axes. Exceeding a threshold triggers the motor to spin faster or slower.

LED Bar:

The bar LED is used to show when the FSR, sound and tilt sensors are triggered.

FSR Sensor:

The FSR sensor reads an amount of force being put on it, and activates a series of LEDs once a threshold is hit.

RGB LED:

The RGB LED is a feedback device used to communicate when the ultrasonic sensor goes off. It flashes a series of red, green, and blue lights.

Audio Sensor Module:

The sound sensor detects when a certain decibel threshold is exceeded, and turn on the bar LED as a response.

Tilt Switch:

The tilt sensor reads when a interior ball rolls past a certain point, and triggers the bar LED as a response.

PIR Sensor:

The PIR sensor is used to detect motion via infrared light. By moving rapidly or slowly within its field of view, we speed up or slow down the motor.

Ultrasonic Sound Sensor:

The ultrasonic sensor uses ultrasonic sounds waves to detect how far something is, and triggers the RGB LED once it reads something near.

Wireless Communication:

ESP32 Configuration:

To send signals between each operator, wifi communication is used via a pair of Esp32s. These devices allow us the standby operator to tell the master operator where to point the laser, and allow the master operator to tell the standby operator where they have aimed the laser.

Bill of Materials

415 Elec BoM