Antenna Matching

Written by Zachary de Bruyn (Electronics & Control)

Table of Contents

Purpose

The PeteBot chassis team is unique in that it is utilizing two PCBs which operate on two different MCUs; the first being the heritage 3DoT v5.03 board which uses the ATMega32U4, and the second being the SAMB11, which incorporates the ATSAMB11. One significant different between the two boards is that the SAMB11 has a transceiver module. Because the SAMB11 can operate with the incorporated Bluetooth (BLE), an antenna network was needed to be designed to utilize the BLE transceiver. Because an antenna network was needed to be constructed with minimal input from the SAMB11 reference design, many steps were required to be performed in order to ensure that the SAMB11 could operate at the 2.4-GHz BLE frequency.

Antenna Selection

The first step in the overal process of incorporated a matching network is selecting a proper antenna based on the needs of the system. To reiterate, the operating frequency of BLE is 2.4-GHz. Along with frequency requirements, there are also size requirements. Our antenna therefore was required to operate at the BLE frequency, to be small enough to fit on a PCB, and to operate the PeteBot chassis. These requirements alone narrowed the possibilites of two types of antennas: PCB or chip antennas. With the PCB antennas, one antenna that looks promising is the meandered inverted-F antenna (MIFA). The chip antenna resembles a 0805 resistor or inductor. The two antennas are shown below:

Figure One – MIFA (Source: Cypress)

Figure Two – Chip Antenna (Source: Cypress)

Analyzing both types and data sheets of antennas, we discover that both antennas have an isotropic radiation pattern, meaning that the frequency of the antenna can be picked up equally from almost every direction. This is ideal for our applications due to the fact that the PeteBot will be required to operate via RC mode by an operated. A few other important antenna parameters are: return loss, gain, and bandwidth. Return loss is essentially how much of the power being transmitted is reflected due to the mismatch of the antenna’s imepdances. The standard for impedances is usually 50-Ohms. A return loss greater or equal to 10-dB is considered ideal for operation [1]. Referring to the following equaltion for return loss:

Equation (1)

At a return loss of 10-dB which translates to 90% of power transmittered going into the antenna, return loss of 20-dB translates to 99%. The gain is a measure of ow strong the radiation field is compared to the ideal omnidirectional antenna. For isotropic antennas, like that being applied to the PeteBot, gain is measured as dBi. The “i” simply indicates that the gain is measured frerence to an istropic antenna. While the MIFA antenna has a gain of about 5-dB depending on the plane of radation, the chip antenna has a peak gain of 0.5-dBi. The bandwidth requirements for the antennas requires that the BLE frequency is capable of interception, which was 2.4-GHz. The chip antenna has a frequency range of 2.4- to 2.5-GHz, which translates to a bandwidth of 100-MHz. The MIFA antenna operates a a comparable frequency range, and therefore has an equivalent bandwidth.

With comparable operational characteristics, an antenna selection for our purposes was based upon flexibility, in which the antenna can be used in a variety of configurations for the SAMB11 board. In the case of the PeteBot SAMB11 PCB, the chip antenna is the best candidate.

Matching Network

The purpose of an antenna matching network is to allow the most power to be delivered to the load. The load in the case of transcievers, like the SAMB11, is dependent on whether the antenna is transmitting or receiving. If the antenna is transmitting, then the antenna is the load, whicl the SoC SAMB11 is the load if the system is receiving. It is common practice to design a load with 50-Ohm impedences for RF traces [1]. As a review, the term impedance is mathematically defined as the magnitude of resistance and reactance. It is typically denoted by the letter “Z.”

Equation (2)

Equation (3)

In Equations (2) and (3), R denotes resistance, and X for reactance. Both values are measured in Ohms.

Now that impedance is defined and the typical characteristic impedance is defined as 50-Ohms, this information can be used in collaboration with the helpful tool called a Smith Chart.

Smith Chart

It is a graphicaly tool used to help plot complex impedances and used to define a matching network. It is also helpful in determining many important RF parameters, including VSWR, return loss, reflection coefficient, and transmission coefficients. Using this chart can design a matching network.

Figure Three – Smith Chart (Courtesy of Wikipedia)

There are a lot of reference towards using Smith charts on YouTube that will explain how to find the difference parameters.

The best usage of the Smith chart is to be able to measure the input impedances going into a load, where the input impedance is defined as Z_in. Character impedance is Z_0 and the load impedance is Z_L.

As an example, let’s say that the measured Z_in was 100-j100-Ohms. The first step would be to normalize the input impedance by dividing Z_in by Z_0, which would result in 2-j2-Ohms. This opint can be located on the Smith chart, and from this point (2-j2), you can use a combination of inductors and capacitors to move the impedance to the necessary location on the Smith chart, which is the center of the chart where the red dot is in Figure 3. The table below helps better understand how each component affects the impedance of the matching network.

Table One

Using any combination of passive elements can be used to get measured impedance as close as possible to the center of the Smith chart for optimal performance. If we refer to the matching newtorks in Figure 4 and Figure 5, we can see that the matching network consists of the passive elements described in Table One.

Figure Four – Chip Matching Network Antenna Reference Design

Figure Five – SAMB11 Matching Network Reference Design

Figure Five depicts the matching network reference design for the SAMB11 where the resistance network shown in the dotted square is omitted from the final design PCB. Also omitted was the capacitor laveld DNI (Do Not Include).

S-Parameters

Scattering parameters, or “S-parameters” are a set of parameters which define the electrical power delivered between two ports on a network, where a port is any where within the network containing voltage or current delivery [6]. The four parameters are displayed below:

Table Two – S-Parameters

The reflection coefficient referred to in the S11 description is defined as followed:

Equation Four – Reflection Coefficient

Where  are the reflected and incident plane waves, and the  is the intrinsic impedance of the medium the wave is traveling through, and  is the intrinsic impedance of the surface/material medium the wave reflects or penetrates [5].

The S-parameters can be collected by using a Vector Network Analyzer, however they are fairly expensive, usually greater than $10,000 on the lower end models. As a substitute, there is software such as Microwave Office or Optenni which can calculate the S-parameters as well. While these software suites are NOT free, they do offer free “research” trials where you can use it free for a week (Microwave Office) or for a month (Optenni).

Optenni provides the most tutorials on how to get familiar with the basics of the software, and also offers an optimization tool which allows you to designate specific requirements you want for your design. For instance, in the case of the SAMB11 3DoTX board, the requirements for BLE is that it resonate at 2.4-GHz. By using Optenni, desired parameters can be chosen, and a matching circuit will be automatically constructed through the software. (Click Here, it will redirect you to the Optenni technical resource page).

Figure Six – S11 Parameter

Example

As seen in the S parameter chart in figure 6, the S11 parameter extends just beyond -20-dB. The figure therefore suggests that at approximately -20-dB the antenna radiates at its maximum. At 0-dB the antenna radiates nothing. While this simulation may  look ideal, it is not practical for real world application. This is because the dark blue highlighted bandwidth (2.4-2.483-GHz) is difficult to realize in the physical world. In practical antenna circuits, the resonating frequency an antenna could transmit/receive is always met with some percentage of error, or acceptable deviation from nominal conditions. For example, the chip antenna we have chosen for the 3DoTX board has a frequency range from 2.4 to 2.5-GHz. A 100-MHz difference. By choosing more than the two components that have been shown below, more components can be added to open up the bandwidth of frequencies that can be received/transmitted by the antenna. Another great feature with Optenni is that you can tune the component values to see how each one effects the S11 parameter.

Figure Seven – Smith Chart (top) and matching generated circuit (bottom)

By looking at the smith chart in figure 7, we see that dark blue are highlighted on the graph corresponds with the dark blue area highlighted in figure 6. Recalling the information presented earlier about the smith chart and 50-Ohm impedances, we can see that the matching circuit accurately tunes the antenna to operate at the matched approximate 50-Ohm impedance.

In the matching circuit shown, the port corresponds with the input (i.e. the antenna) and the load corresponds with the SAMB11.

References

[1] Reference One

[2] Reference Two

[3] Reference Three

[4] Reference Four

[5] Fundamentals of Engineering Electromagnetics by David Cheng

[6] Reference Six

Acknowledgements

Thank you for Dr. Densmore, Dr. Rezvani, and Dr. Haggerty for help in contributing to understanding the matching network.

Gear Studies

Written by Railan Oviedo (Manufacturing)

Objective

For the Pete-Bot’s (P-Bot) method of movement, our project has implemented a
planetary gear system that incorporates the incline gear as the wheel and 3 planetary gears. The top planetary gear will be the driving gear that is connected to the GM6 motor, while the other two planetary gears will have ball bearings inserted into them—effectively making their presence their solely for the purpose of properly spacing the incline gear. In order to ensure the whole structure stays together, washers will be placed to prevent them from touching the chassis, and a triangular gear holder will be utilized to prevent the system from popping off the chassis.

Preliminary

For a planetary gear system to work, specific parameters must be made in order to ensure the gears can smoothly spin together. The equations to ensure this are as follows:

Equations (1) to (3) to determine the number of teeth for the gears and pitch diameter

“N” represents the number of teeth for the incline gear ring, the planetary gears, and the sun gear. As stated in the introduction, the sun gear will not actually be implemented, but it is still necessary for designing purposes. The variable “r” is for the ratio of revolutions between the sun gear and the incline gear.

The Pitch Diameter “PD” is the effective diameter of the gears, and it is determined by multiplying the number of teeth by the gear module “M.” The modules must be the same for all the gears in the system in order for them to operate smoothly.

Test 1

The initial “r” value chosen for the system was 3, so the sun gear would spin 3 times for every spin of the incline gear. The modules have been set to 1, so the number of teeth also determines the pitch diameter in millimeters. For the first trial, the incline gear was chosen to have 40 teeth – thus resulting in a 40 mm pitch diameter – with an outer diameter of 45 mm. From the equations, the other parameters were found as the following:

Equations (4) & (5) that show the number of teeth calculated

With this, SolidWorks was used in order to generate a simulation for the gears.

Image One – Initial Gear System

Because of the ball bearings, the lower planetary gears will have an increased inner diamater of 1/4 of an inch. This system was laser cut in order to rapid prototype with the P-Bot chassis.

Video Link

Image Two – Initial Wooden Gears

Gear Holder

The gear holder was made to fit the shape of the first gear system. The design is shown in the picture below:

Image Three – Gear Holder

The measurement numbers are given in centimeters. The 4 cm diameter circle represents the pitch diameter of the incline gear, and the 5 cm diameter circle reqpresents the total diameter of the wheel including the tire treads.

Test 2

After testing how the ring actually functions on the chassis, it was seen that the planetary gears for the ball bearings are incredibly flimsy. Furthermore, the wheel is not large enough to surpass the bottom of the chasis, as shown in the picture below:

Image Four – Rapid Prototype Implementation of Incline Gear

Due to this, a new system that utilizes a 42-teeth incline gear with “r” equal to 4 was used in order to increase the diameter of the wheel. From the equations, the other gears’ teeth were found as:

Equations (6) & (7) show the new number of teeth determined for the new gear system

Since the planetary gears will now have a wider pitch diameter, this should eliminate the issue of their stability for the ball bearings. Using this, another SolidWorks model was made, and these were also laser cut for rapid prototyping.

Image Five – Second Gear System

Image Six – Second Set of Wooden Gears

Results

After trying the alignment pattern of the gears for Test 2, it was found that the incline gear ring would not touch the driving planetary gear due to the fact that the incline gear becomes slightly raised when it is placed on the ground.

However, when attempting to use the 14 teeth gears in tandem with the alignment for Test 1 (Refer to Image 1), it was discovered that the gears were very close to being in the perfect spots for the whole system to function properly. Minor tweaks would need to be made on this alignment in order to get the positioning correct.

Test 3

The third and final test was to adjust the alignment from Image 1, and to then use the 14 teeth gears in place of the actual gears that should be used for it (i.e. 10 teeth planetary gears, and 20 teeth sun gear).

Image Seven – SolidWords Model for Test 3 (in mm.)

The original distance between a planetary gear and the sun gear was 15mm. This distance is reduced in the hopes of having the incline gear ring fit. To test whether this would work, the alignment pattern was cut out onto wood via a laser cutter.

Image Eight – Test 3 Alignment Cut-Out on Wood

The gear holder was also altered to fit this new alignment. The sides were made thinner so it is possible to see the gears behind it, and a slit was added to one side in order to indicate which side connected to the driving planetary gear. This side was also made slightly longer than the others in order to accommodate the fact that the incline gear slightly rises when it is on the ground.

Image Nine – Gear Holder for Test 3 (in mm.)

After laser cutting out the gear holder, the alignment pattern was tested and confirmed to work extremely well. Small washers were put in place between the wooden plate and the gears, and between the gears and the gear holder. These washers were small enough so that they only come into contact with the bearings inserted into the gears, thus resulting in a very small amount of friction when trying to spin the incline gear. The assembled pattern and a reference video are given below:

Image Ten – Test 3 Alignment Assembled with Gears

Video Link

D-Gear

Although the alignment was set, it now became necessary to change the driving planetary gear so that it fits the shape of the new GM6 motor shaft, which has a D-shaped profile. The model for this gear is given below:

Image Eleven – D-Gear

With the alignment set and the D-Gear created, it was then implemented onto the chassis itself, and can be seen as:

Image Twelve – Assembled Planetary Gear System

References

[1] Reference One

PeteBot Requirements

(Written by Elizabeth Nguyen (Project Manager) & Melwin Pakpahan (Missions, Systems, & Test)

Table of Contents

Objective

The requirements for the PeteBot (3DoT Chassis) are defined at two levels and provide the team with direction and to determine what shall be accomplished. Verification and validation are also outlined.

Current Status:

At this time, not all requirements have been confirmed and are pending approval. Some of the requirements listed below are different from the requirements listed in the PDD.

Level One Requirements

Program Requirements

  1. PeteBot shall be completed by Wednesday, December 13, 2017.
    1. This requirement coincides with the last day of class.
    2. This is the projected demonstration date for all toy robots.
  2. PeteBot shall cost no more than $200 as projected by the customer.
  3. PeteBot will be a toy robot.
    1. This requirement is defined through the customer expectations.

Project Requirements

  1. PeteBot shall use the PBX11 which is an alternative microcontroller to the 3DoT Board that utilizes the SAMB11 chip instead of the ATMega32U4 chip.
    1. In case the PBX11 board is inoperable, the 3DoT Board shall be used in its place.
  2. PeteBot shall navigate through a maze with remote control through the ArxRobot App or the Arxterra Control (based on Project and Mission Objectives).
  3. PeteBot shall be no larger than 4 x 3.5 x 3 inches.
    1. These measurements were taken at the widest dimensions of the chassis since it tapers at the bottom.
  4. PeteBot shall be able to memorize a path through the maze that is taught by the user (based on Project and Mission Objectives).
  5. PeteBot shall be able to autonomously travel down the path that was memorized (based on Project and Mission Objectives).
  6. PeteBot should be able to navigate the maze and avoid collisions when multiple robots are in the maze.
    1. The Rules of the Maze for the avoidance algorithm have been defined.
    2. Line following will be implemented if the motoer encoders are funtional.
  7. PeteBot shall have a chassis that is 3D printed.
    1. This is derived from a customer expectation.
  8. The total 3D print time of PeteBot’s chassis shall not exceed 2 hours (based on Project and Mission Objectives).
  9. The main body (chassis) of PeteBot shall be of one solid piece.
  10. PeteBot shall be assembled per the guidelines of Disassembly and Reassembly.
  11. The PeteBot Paper Shell shall resemble the CSULB mascot, Prospector Pete.
    1. This is a customer expectation.
  12. The PeteBot shall be able to perform all functions as programmed by the Arxterra app.
    1. This includes custom commands.

Level Two Requirements

System Requirements

  1. PeteBot shall operate for no less than 20 minutes using a fully charged battery.
  2. PeteBot shall attain an operating speed no slower than 3 centimeters per second.
    1. This speed is referenced from Mission Duration.
  3. PeteBot shall utilize the Generic Color Sensor Shield for line-following.
  4. The PBX11 board shall fulfill the requirement to be a custom PCB.

Subsystem Requirements

  1. PeteBot shall be powered by a RCR123A Lithium Polymer battery.
  2. PeteBot shall use a planetary gear system.
  3. The Generic Color Sensor Shield shall be located at the front of the PeteBot.
  4. PeteBot shall have a castor wheel under the Generic Color Sensor Shield to support the mobile phone.
  5. PeteBot shall utilize two GM6 brushed DC motors with an extended D-shaped shaft.
  6. PeteBot shall utilize two shaft encoders for line following.

Electronic Component BOM and Order: PeteBot

Written By: Muhannad Al Mohamed (E&C DM)

Components

The PeteBot(3DoT Chassis) uses electronic components listed in the figure below. These parts include the electronic parts that would be used in making the project’s costume PCB as well. This list needs to be updated to include the new color sensor with its related components. As seen on the list, some parts have been acquired by the project’s members; however, the rest should be ordered.

Old PBot Parts list

Update: 11/19/2017

A detailed version of the parts list used by the PeteBot is added is provided in the figure below. All the parts used to make the custom PCB using the SAMBII are included too. These parts are being ordered by the members of the project are expected to arrive soon. Parts used in making the new Color Sensor Shield are included as well.

  • IC CONTROLLR LI-ION 4.2V SOT23-5 (296-27017-1-ND)
  • IC REG BOOST ADJ 1.2A SYNC 10SON (TB6612FNGC8ELCT-ND)
  • IC MOTOR DRIVER PAR 24SSOP (MCP73831T-2ACI/OTCT-ND
  • IC REG LDO 3.3V 0.5A SOT23-5 (576-1281-1-ND)
  • RF System on a Chip – SoC BLE 4.1 SOC Ultra Low Power  (556-ATSAMB11G18A-MUY
  • BATT HOLDER CR123A THRU HOLE (BH123A-ND
  • FUSE PTC RESET 8V .75A 1206 (F3370CT-ND
  • FIXED IND 4.7UH 640MA 220 MOHM (308-1947-1-ND)
  • FERRITE BEAD 120 OHM 0201 1LN (490-2557-1-ND
  • 0.1µF ±10% 16V Ceramic Capacitor X7R 0402 (1005 Metric) (490-3261-2-ND
  • 1.8pF ±0.1pF 200V Ceramic Capacitor A 0402 (1005 Metric) (478-6406-1-ND
  • 3.9pF ±0.25pF 200V Ceramic Capacitor A 0402 (1005 Metric) (478-6413-1-ND
  • 1µF ±20% 6.3V Ceramic Capacitor X5R 0402 (1005 Metric) (478-5315-1-ND
  • 2.2µF ±10% 6.3V Ceramic Capacitor X5R 0402 (1005 Metric) (478-7885-1-ND
  • 10000pF ±5% 16V Ceramic Capacitor X7R 0402 (1005 Metric) (478-3664-1-ND
  • 4.7µF Molded Tantalum Capacitors 6.3V 1206 (3216 Metric) 4 Ohm (478-8176-1-ND
  • plus/minus 20% Ceramic Cap X5R 0402 (478-10791-1-ND)
  • 1.2pF ±0.1pF 50V Ceramic Capacitor C0G, NP0 0402 (1005 Metric) (478-10145-1-ND
  • Aluminum Electrolytic Capacitors – SMD 10uF 63V (667-EEE-FK1J100P
  • LED RED CLEAR 0603 SMD (160-1447-1-ND)
  • LED YELLOW CLEAR 0603 SMD (160-1448-1-ND
  • LED GREEN CLEAR 0603 SMD (160-1446-1-ND
  • CONN USB MICRO B RECPT SMT R/A (609-4618-1-ND
  • SWITCH SLIDE SPDT 300MA 4V (563-1102-1-ND
  • 3nH Unshielded Multilayer Inductor 300mA 260 mOhm Max 0402 (1005 Metric) (712-1457-1-ND
  • 9.1nH Unshielded Multilayer Inductor 500mA 260 mOhm Max 0402 (1005 Metric) (490-8390-1-ND
  • 4.7µH Shielded Wirewound Inductor 500mA 240 mOhm 0603 (1608 Metric) (445-3607-1-ND
  • 3.3nH Unshielded Multilayer Inductor 300mA 190 mOhm Max 0402 (1005 Metric) (712-1416-1-ND
  • 2.7nH Unshielded Multilayer Inductor 300mA 170 mOhm Max 0402 (1005 Metric) (712-1415-1-ND
  • 1 kOhms ±5% 0.2W, 1/5W Chip Resistor 0402 (1005 Metric) Automotive AEC-Q200, Pulse Withstanding Thick Film   (RHM1002CT-ND)
  • 22 Ohms ±5% 0.2W, 1/5W Chip Resistor 0402 (1005 Metric) Automotive AEC-Q200, Pulse Withstanding Thick Film (RHM1012CT-ND
  • 1 kOhms ±5% 0.2W, 1/5W Chip Resistor 0402 (1005 Metric) Automotive AEC-Q200, Pulse Withstanding Thick Film (RHM1002CT-ND
  • 2 kOhms ±5% 0.1W, 1/10W Chip Resistor 0402 (1005 Metric) Automotive AEC-Q200 Thick Film  (P2.0MJCT-ND)
  • 2 MOhms ±5% 0.1W, 1/10W Chip Resistor 0402 (1005 Metric) Automotive AEC-Q200 Thick Film (P2.0KJCT-ND)
  • 220 kOhms ±5% 0.1W, 1/10W Chip Resistor 0402 (1005 Metric) Automotive AEC-Q200 Thick Film (P220KJCT-ND)
  • 10 kOhms ±5% 0.1W, 1/10W Chip Resistor 0402 (1005 Metric) Automotive AEC-Q200 Thick Film (P10KJCT-ND)
  • Thick Film Resistors 0.1watts 1Mohms 1% (660-RK73H1ETTP1004F)
  • 26MHz ±10ppm Crystal 12pF 60 Ohms 4-SMD, No Lead (SER4186TR-ND)
  • 32.768kHz ±20ppm Crystal 4pF 60 kOhms 2-SMD, No Lead (535-12373-1-ND)
  • VL6180X FlightSense™ Light, 3D Time-of-Flight (ToF) Sensor Evaluation Board (1528-1815-ND)

 

Updated PBot parts list

Color Sensor Shield parts

Written By: Muhannad Al Mohamed E&C DM

Testing of the TCS34725 (Trade-off study)

Written by Zachary de Bruyn

Purpose

The purpose of this experiment was to test the TCS34725 RBG Color-to-Digital sensor to determine if it was applicable for the purposes of the EE400D project “PeteBot”. The testing included testing of the sensitivity of the sensor, its ability to distinguish difference between colors, and performing studies as to the limitation of the sensor.

DC Characteristics of the TCS

The TCS operates at a nominal voltage of 3-V with a maximum being 3.6-V. Depending on the state of the device, the current drawn ranges from 235-uA in an active state down to 2.5-uA in a sleep state.

DC Characteristics at the board level

The board is designed for usage with the Arduino where the VIN input is designed for 5-V, and draws XXXX A current.

The TCS34725: The TCS34725 at the component level is the physical IC located on the breakout board that reads colors and digitizes them for the benefits of the user. Therefore when referring to the TCS34725, it is in reference to the actual IC, whereas when referring to the board, it is implied that we are talking about the entire board with all IC’s and passive components.

The TCS utilizes an I2C interface with a slave address as 0x29 in hexadecimal. Therefore in order to implement multiple TCS’ within the same I2C bus, certain precautions will need to be utilized, such as an I2C extender.

The block diagram of the TCS is shown below. From the diagram it can be seen that the light entering the sensor is filtered before going through four ADC afterwhich the signal is digitized into four different color data sections: Clear, Red, Blue, Green. The digitized data is then sent via I2C bus to the respective MCU being utilized; in this case the Arduino Uno.

Figure 1: TCS Block Diagram

Breakout Board: The schematic of the breakout board is provided below, and is courtesy of Adafruit.

Figure 2: Breakout Board Eagle Schematic

As shown by the breakout board schematic, the board is powered by a 5-V input through the VIN pin on the board, and is then stepped down through an LDO (RT9193) to 3.3-V. The 5-V is also used for the source voltage for the two MOSFETs utilized in the circuit. The 3.3-V is then used as the gate voltage for the MOSFETs, and is also the input voltage necessary for the majority of the circuit including the TCS and LED MOSFET.  The breakout board also utilizes this 3.3-V and provides a 3.3-V output through the board (via pin 3, ‘+3V3’).

Test Set-Up

The purpose of this test was to determine the TCS’ ability to distinguish between colors. This test was performed by covering a square piece of cardboard with white tape, and then applying a half-inch strip of electrical tape down the center. The black tape is to simulate the lines of the maze, and the TCS’s ability to detect between colors. The basic test setup is given by Adafruit, where the VIN pin of the breakout board is powered via the 5-V of the Arduino, and the SDA and SCL inputs are connected to analog pins 4 and 5.

Figure 3: Fritzing Diagram

Next a circular wall was constructed to surround the breakout board so that testing can be done in a controlled environment which would mitigate the sensors ability to pick up any ambient light. This wall also allows us to maintain a static distance between the breakout board and the test strip that will be utilized to test the sensors ability to distinguish colors. Two LED’s were also utilized which would help determine if the correct value was being measured. When the correct color was measured (predetermined by me) the green LED would emit, else the red LED would light.

The code below was provided in the Adafruit library, and was modified in order to test the ability of the board to read colors.

/* Source provided by Adafruit and modified by Zach de Bruyn CSULB EE400D
   Connect SCL    to analog 5
   Connect SDA    to analog 4
   Connect VDD    to 5V DC
   Connect GROUND to common ground
 */

#include <Wire.h>
#include "Adafruit_TCS34725.h"

const int greenLED = 4;
const int redLED = 7;
const int fwd = 10;
const int rvs = 11;

/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);

void setup(void) {
  Serial.begin(9600);
  pinMode(greenLED, OUTPUT);
  pinMode(redLED, OUTPUT);

  if (tcs.begin()) {
    Serial.println("Found sensor");
  } else {
    Serial.println("No TCS34725 found ... check your connections");
    while (1);
  }

}

void loop(void) {
  readSensor();

 }

void readSensor (){
    uint16_t r, g, b, c, colorTemp, lux;

  tcs.getRawData(&r, &g, &b, &c);
  colorTemp = tcs.calculateColorTemperature(r, g, b);
  lux = tcs.calculateLux(r, g, b);

  Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - ");
  Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - ");
  Serial.print("R: "); Serial.print(r, DEC); Serial.print(" ");
  Serial.print("G: "); Serial.print(g, DEC); Serial.print(" ");
  Serial.print("B: "); Serial.print(b, DEC); Serial.print(" ");
  Serial.print("C: "); Serial.print(c, DEC); Serial.print(" ");
  Serial.println(" ");

 // digitalWrite(greenLED, HIGH);
  int color = r + g + b;

  Serial.print("Color: "); Serial.print(color); Serial.print(" ");

  // If black is sensed turn green LED on, else red LED is on.
  if (color < 8000 && color > 7000){
    digitalWrite(greenLED, HIGH);
    digitalWrite(redLED, LOW);
  }

  else{
    digitalWrite(redLED, HIGH);
    digitalWrite(greenLED, LOW);
  }

}

As seen in the redSensor() function. It is within this function that the sensor reads the individual digitized color. A variable ‘color’ was created which summed these values, and then these values were compared to a predefined range which would measure the black strip on the white background. In this case, the range was from 7000 to 8000.

Test Results

Video: Color Sensor Demonstration

Current Draw of GM-6 Motors

Written by Zachary de Bruyn

Purpose

The purpose of this testing is to determine the amount of current the motors draw when supplies with a CR123 – 3.7 V battery. The motors were inserted into the “3DoT Chassis” and to simulate the amount of current the motors draw when supplied with a load; in this case the weight of the chassis, running at 3.7 V.

Test Set-Up

The test utilized was performed using the Arduino Uno and a voltmeter for redundancy. The setup is displayed below in figure 1. The two GM6 DC motors were inserted into the 3DoT chassis, as shown in the figures at the end of this blog. The chassis was then anchored by string to a desk to prevent it from moving while conducting the tests.

Figure One – Test Setup

The motor load shown in figure 1 consists of two motors in parallel with a shunt resistor, R3, connected to the non-inverting input of an LM731 opamp The goal of this schematic was to drive a voltage gain at the output of the opamp that could then later be used to accurately measure the current draw of the two dc motors.

Going over some basic opamp characteristics:

  1. For ideal opamp the input resistance is infinite to both the inverting and noninverting inputs.
  2. The inverting opamp inputs drive each other to be equal, therefore:
  3. For the inverting setup as displayed in figure 1, the gain is given as:

By recalling the three basics of the opamp listed above, we can then accurately measure the voltage (vin) that is measured across the 0.5-Ohm wire resistor. At the output of the opamp, a wire was connected to the A0 pin of the Arduino Uno. The 5-V supplied by the Arduino acted as the rail for the opamp and the CR123 battery was used as the dc input to power the load (motors). The following code was then uploaded through the Arduino IDE which allowed us to use the ADC from he A0 pin to measure the voltage at the output in 1s intervals.

/* Voltage Meter code Original source credit to https://www.allaboutcircuits.com/projects/make-a-
digital-voltmeter-using-the-arduino/

Modified for uses with RC123 Battery by Zach de Bruyn CSULB EE400D*/

const float referenceVolts = 5; // The measurement of your battery
const int batteryPin = A0; // battery is connected to analog pin 0

void setup()
{
Serial.begin(9600);
}

void loop()
{
int val = analogRead(batteryPin); // read the value from the sensor
float volts = (val / 1024.0) * referenceVolts; // calculate the ratio
Serial.println(volts); // print the value in volts
delay(1000);
}

A voltmeter was used to measure the voltage over the small resistance wire as a form of redundancy and accuracy checking of the Arduino code. The experimental measurement of the wire resistor was 0.5-Ohms.

Test and Results

The voltage was read from the Arduino serial monitor which averaged at 2.46-V. This is the “vout” from the gain equation earlier. The overall gain of the system was 2, where the resistors of equal value added to the 1 of the equation. Solving for vin, we find that the vin value is 1.23-V.

Recalling the three basic opamp rules earlier, we know that the infinite input resistances of the opamp causes no current to flow through the inputs, instead, all current goes through the 0.5-Ohm shunt resistor. Because the inputs drive each other to equal zero, the shunt resistor essentially acts as a voltage divider for the circuit. Therefore, the vin calculated, is the voltage over the shunt resistor. Performing Ohm’s law, we find that the current through the load is 2.46-A, where the current is assumed to be evenly split between the two motors in parallel, implying that each motor draws 1.23-A of current.

The voltages collected from the Arduino were then gathered into Matlab and analyzed through the following code:

clear all, clc
V_m = [ % Values collected from Serial Monitor];

x = smooth(V_m, 0.3, 'loess');

plot(V_m/0.5, '.b'); grid on;
hold on
plot(x/0.5, '.r', 'linewidth', 1.5)
hold off
xlim([0, length(x)])
legend('Raw Data', 'Smooth')
xlabel('Time - sec'); ylabel('A');
title('Arduino measurements')

As we can see from the data points collected from the Matlab plot, the current fluctuated between 2.46 and 2.47 A, with an average being 2.46-A. The raw data collected every second is displayed in blue, while the averaging data is displayed in red.

Figure Two – Plotted data with trend line

Pictures of Physical Test Set-Up

Not shown are the wheels or string which suspended the movement of the chassis, however, the general understanding of the setup can be achieved with the following pictures.

Figure Three – Physical setup of circuit

 

Pete-Bot – Measuring Power Consumption

Written by Melwin Pakpahan (Mission, System, Test)

Description:

The power consumption of the 3DoT board will be measured as follows. A RCR123A battery will be connected in series with a test resistor and the 3DoT board. Two versions of the 3DoT board will be tested and compared. The test resistor is chosen to be 1 ohm, and the current draw is to be determined. When the power source is switched on, the voltage across the resistor is used to calculate the current going through the circuit using Ohm’s law.

Equation 1 – Ohm’s Law

Equation 2 – Variation of Ohm’s Law

 

Considerations

  • The battery is fully charged before any test is conducted.
  • A test code (“Motor_Operation_Test”) has been verified and uploaded to the 3DoT Board.
  • The motors continulously run during the test.

Cases

There are three cases of testing for the power consumption.

  1. Case One – Testing power consumption with no motors
  2. Case Two – Testing power consumption with one motor running
  3. Case Three – Testing power consumption with two motors running

Case One

Figure One  shows the circuit diagram for this first test:

Figure One – Circuit diagram for testing power consumption (general)

Case Two

A GM6 motor is connected and running as shown in Figure Two.

Figure Two – Circuit diagram for testing power consumption with one GM6 motor attached

Case Three

Two GM6 motors are connected and running as shown in Figure Three.

Figure Three  – Circuit diagram for testing power consumption with two GM6 motors attached

Constraint

Up until this point, Bluetooth communication has not been established yet. The procedures above will be repeated once communication is established.

Results

Figure Four shows a measurement of the resistor. Although, the specified value is 1 ohm, the actual value is 1.1 ohm. This measured value is desired since it provides a more accurate measurement of the current values. Figure Five shows the test run of the 3DoT board Rev 4.46 without actuators and without Bluetooth pairing. Table 1 shows the results of each test case.

Figure Four

Figure Five

Table of Results

Table One – Table summarizing results

References:

[1] Featured Image

Robot Avoidance Pseudocode

Written  by Elizabeth Nguyen (Project Manager)

Description: (updated on 11/19/17)

The robot avoidance code is a program that will allow robots to avoid each other under various cases after a robot detects another. There currently two parts: (1) Robot Detection (written by John Campo) and (2) Robot Avoidance. The psuedocode outlines a potential algorithm that can be implemented for the Robot Avoidance code.

Currently, this task is linked to Rules of the Maze.

Constraints

Due to the complexity of this algorithm, the psuedocode only assumes that two robots may collide with each other. Later on, it can be built upon in the case that three robots may collide with each other or even four.

Because of this constraint and based on the Rules of the Maze, it can be assumed that North- and East-facing robots will be not need to stray off their paths when “colliding” with a robot. South- and West-facing robots however will have to carry the burden to move away to allow the respective North- and East-facing robot to continue forward.

Also, regardless of direction, any robot located in an intersection will automatically carry the burden of moving away.

Pseudocode

Avoidance
   Identify direction
   Find out which room robot is in (Subroutine - WhichRoom)
   Get location from WhichRoom
   If the robot is in an intersection
      Save current location (this location can be passed to another subroutine where it can return to its original path)
      Move away (Subroutine - MoveAway)
      Return to its original path
      Continue the maze path
   Else (this is where direction will matter)
      If the robot is facing North OR East
         Check if a robot is in front of it (Subroutine - CheckAgain)
         Wait for 30 seconds (to ensure that the robot facing South moves away)
         Continue the maze path
      If the robot is facing South OR West
         CheckAgain
         Save current location (this location can be passed to another subroutine where it can return to its original path)
         Move away by backing into the nearest corner or intersection
         Return to its original path
         Continue the maze path
         
WhichRoom
   Determine location
   Return location to Avoidance subroutine

MoveAway
   Determine path to take
   Move backwards
   CheckAgain
   Return to Avoidance subroutine

CheckAgain
   Run Robot Detection Code
   If robot is detected
      Return to Avoidance subroutine
   Else
      Resume original path

Other Notes

Despite the current pseudocode possessing the parts of if-else statements, I believe it would be better to implement a finite state machine for avoidance. There also could be complications with determining how a robot can return to its original path after moving away. Interrupts may need to be utilized since there are many moments where a robot may not need to complete the avoidance subroutine.

Pete-Bot Custom Command and Telemetry

Written by Elizabeth Nguyen (Project Manager)

Description:

A short list of custom commands and custom telemetry are defined in preparation for the EE 400D Fall 2017 Mission.

Custom Commands

  • Adjustable Speed Commands – Allows the robot to run at a specific set speed
    • Option for slowest speed
    • Option for medium speed
    • Option for fastest speed
    • On/Off for adjustable speed
  • Emergency On/Off Command – in the case that the robot is incapable of operating in Phase 2b
    • This is to avoid damage to the robot and other robots
    • Avoids the need for anyone to step into the maze and pick up the robot to disable it

Custom Telemetry

  • Display of Phase the robot is operating in
  • Robot detected
    • State that the robot is in during robot avoidance

Mission Definition

Written by Elizabeth Nguyen (Project Manager)

Table of Contents

Objective:

The total time for each phase of the mission set is determined in order to ensure there is enough time allocated for the entire mission set to be completed in 120 min.

This document entails the breakdown of the mission set and how much time is split for each phase based on the maximum speed of each robot as provided in Mission Duration at Maximum Speed.

Phases:

  • Phase 1 – Record
  • Phase 2a – Individual Playback
  • Phase 2b – 4 Robots, 1 Maze
  • Phase 2c – Individual Playback (Pre-defined)*

* Phase 2c is optional and based on the success of Phase 2a

Robot Order: (from fastest to slowest)*

  • Pete-Bot** – 6 min.
  • ModWheels** – 7 min.
  • Sojourner** – 14 min.
  • Goliath – 18 min.

* All times have been rounded up
** Assumes no load

Speeds & Path Durations used:

Path durations were calculated and documented by Railan Oviedo. There are two documents where one addresses the path duration at maximum speed and another at minimum speed.

The bolded texts indicate which numbers I used to determine allocated time.

Types of Path Scenarios:

  • Shortest Path Scenario
  • Average Path Scenario

Speeds:

  • Half Speed – Min Speed
  • Half Speed – Max Speed
  • One-Third Speed – Min Speed
  • One-Third Speed – Max Speed

One-third speed was chosen (and suggested by Mark Huffman) to account for potential decrease in time due to added weight (since all but one robot have provided speeds under no load conditions). Although half-speed would be better to use for worst-case scenarios, it may not be as reasonable either. Also, average path durations were chosen to determine total time allocations at worst.

Breakdown of Mission Set:

  1. Phase 1 – Record
    1. Average Path Scenario at One-Third Speed (Max Speed)
      1. Total Time: 54 min.
        1. Path completion: 45 min.
        2. Rotation: 3 min. x 3 rotations = 9 min.
    2. Concluded Total Time: 60 min.
      1. Rounded up in the case that rotations are not 3 min. each or that some robots end up not performing up to speed due to added weight.
  2. Phase 2a – Individual Playback
    1. Concluded Total Time: 60 min.
      1. Considering that this phase is to test if the robot has properly recorded the maze, it can be assumed that the amount of time it takes to individually playback each robot is the same as Phase 1.
      2. Assuming that there is only one maze available, this means that the amount of time to complete the mission set has been allocated to both Phase 1 and Phase 2a.
    2. Alternative: (has been approved by Hill)
      1. If two mazes are available, then Phase 1 and Phase 2a can occur simultaneously.
      2. Once one robot completes Phase 1, it may proceed to Phase 2a on the second maze.
      3. This would allow Phase 1 || Phase 2a to be completed in 60 min.
  3. Phase 2b – 4 Robots, 1 Maze
    1. Concluded Total Time: 20 min.
      1. Total time is based on the time it takes for the slowest robot (Goliath) to playback its recorded path. At worst, that is 18 minutes; however, including factors such as robots potentially detecting each other and having to avoid each other, 2 minutes has been added in.
        1. Note: At this time, it is unknown how long it will take a robot to execute the Robot Avoidance Code and recover from its detour.
        2. If it takes even longer for a robot to avoid another, maybe a rule should be made where if a robot takes three attempts to correct itself and fails, then it fails Phase 2b and should be removed from the maze.
  4. Phase 2c – Individual Playback with Pre-Defined Maze
    1. This Phase only occurs if a robot fails to complete Phase 2a.
    2. Best Case: 0 min.
      1. All four robots must complete Phase 2a successfully.
    3. Worst Case: 60 min.
      1. All four robots fail to complete Phase 2a.
    4. Duration based on the number of robots at best and at worst in minutes:
      [Mission Set Table]
    5. Disassembly & Reassembly
      1. Total Time: 20 min.
        1. Based on Natalie Arevalo’s conclusion
          1. Disassembly: 10 min.
          2. Reassembly: 10 min.

Scenarios:

  1. Best Case Scenario – 100 min.
    1. Reasoning:
      1. Phase 2c is not required
      2. Phase 1 || Phase 2a (two mazes are required)
    2. Breakdown:
      1. Phase 1 || Phase 2a – 60 min.
      2. Phase 2b – 20 min.
      3. Phase 2c – 0 min. (if all robots succeed in Phase 2a or if Phase 2c is not included)
    3. Disassembly & Reassembly – 20 min.
    4. This scenario has been selected for the demonstration date on December 13, 2017.
  2. Worst Case Scenario – 160 min.
    1. Reasoning:
      1. Phase 2c is not required
      2. Phase 1 and Phase 2a occur separately
    2. Breakdown:
      1. Phase 1 – 60 min.
      2. Phase 2a – 60 min.
      3. Phase 2b – 20 min.
      4. Phase 2c – 0 min.
    3. Disassembly & Reassembly – 20 min.
  3. Absolute Worst Case Scenario – 220 min.
    1. Reasoning:
      1. Phase 2c occurs with all four robots
      2. Phase 1 and Phase 2a occur separately
    2. Breakdown:
      1. Phase 1 – 60 min.
      2. Phase 2a – 60 min.
      3. Phase 2b – 20 min.
      4. Phase 2c – 60 min.
  4. Disassembly & Reassembly – 20 min.