A typical application for analog signals is battery voltage monitoring

Once a complete set of sensors were developed and tested, we implemented a basic remote control application to verify the functionality of the Max32 as well as the AGV platform. Details on the AGV are presented in Chapter 7. We designed the OSAVC with a few goals in mind. The most important of which being that the controller be vehicle agnostic—that is, adaptable to a large class of vehicle types. This translates into the hardware supporting as wide a variety of interface and output protocols as practical. Fig. 3.2 shows a more detailed view of the controller. The firmware architecture was designed to be as simple and as temporally deterministic as possible. To this end the dynamic control algorithm and the state estimation algorithms are modular. This allows these algorithms to be designed and tested in control-specific software and ported out as C functions which can then be compiled with the vehicle firmware directly2 . We demonstrate this approach in Chapter 5. We also required the sensor drivers to be non-blocking and the control loop to operate using a hardware timer to minimize timing jitter. The last goal is to enable as large a community as possible. To support this goal the hardware design and firmware are open source and hosted online.

The sensors we selected are ones typically used in resource-constrained autonomous vehicles. Possibly the most common one is the inertial measurement unit, or IMU. This sensor consists of three triaxial sensors in a single package: gyroscopes to measure angular rotation rates, nft hydroponic system accelerometers to measure specific force, and magnetometers to measure the earth’s magnetic field strength. The gyroscopes are used to compute the dynamics of the vehicle, the accelerometers and magnetometers are used to determine the vehicles attitude relative to known inertial vectors—gravity and the magnetic field. Almost as ubiquitous as the IMU is the GPS receiver. This sensor calculates the vehicle’s location in global coordinates by measuring the range of the sensor to four or more satellites at known orbital locations and computing the optimal fit of those ranges. GPS sensors can also provide other useful data, such as the current time, vehicle heading and speed in inertial coordinates. Another commonly used sensor is an angular encoder. This device measures the angle of rotation around an axis. In the AGV it is used to calculate the speed of the motors as well as the angle of the steering servo. In other areas of robotics they measure joint or actuator angles. The microcontroller itself has built in analog to digital converters . Some sensors communicate their output using analog signals.

The last sensor we selected is a LiDAR sensor . LiDAR is commonly used to detect local obstacles in the environment. It operates by measuring the time of flight of a laser beam on a round trip path from the vehicle to an obstacle. In addition to the sensors decribed above, there are several peripherals commonly needed for autonomous vehicles. Electronic speed controllers are used to provide control signals to brushless DC motors . ESCs require a specific form of PWM signals to command the motor velocity. Servo motors use the same PWM signal but instead control the angle of a motor and are used for various types of actuators, such as robot arms or steering systems. Finally, it is useful to have onboard data storage for vehicle parameter information. A common inexpensive non-volatile memory device is the EEPROM , typically available in the Kbit range. Many autonomous systems rely on remote manual control through serial radio receivers. Other forms of radio control are possible but most modern systems utilize serial data streams. Other radios are used to communicate from the vehicle to ground control systems. These radios typically use a serial protocol. Another form of communication is supported through a serial to USB converter. This can be used as a debug port or to transmit data to an external computer. Finally, the microprocessor is programmed using the Microchip PICkit 3/4 serial programmer.

A summary of the basic sensors and peripherals supported by the OSAVC and their respective hardware interfaces is found in Table 3.1. Every sensor has a physical connector and there are nearly as many connector types as there are sensor types. After a review of the most common connectors we selected the Molex Picoblade for the OSAVC. It is a good compromise between footprint and mechanical reliability. It has 1mm pitch between conductors to minimize size and uses through hole pins for connection to the PCB, making it more reliable than surface mount equivalents, and easier to assemble. Because this research is primarily open source, the tools used for development need to be open source as well; we used the KiCad electrical design automation suite3 for the electrical and PCB layout design. The first design decision before embarking on the electrical design was the choice of microcontroller. we selected a microcontroller that satisfied the requirements listed in the Chapter 2, the Microchip PIC32MX795 series microcontroller, a 32 bit MIPSbased processor. This device includes a wide suite of hardware peripherals including numerous UARTs, SPI ports, I2C ports, IC blocks, OC blocks, and timers. It allows for CAN bus integration with the inclusion of an external CAN transceiver. It operates at a reasonably fast 80 MHz clock frequency, has 128 Kb SRAM and 512 Kb flash memory, is a mature design, and is well supported by documentation and a functional integrated development environment called MPLabX. The PIC32MX795 was offered in a development board which we acquired to begin developing the code base for the controller and for use as a reference design for the OSAVC. The basic requirements for the microcontroller operation are decoupling capacitors on all the voltage input and reference pins, a reset connection to the MCLR pin, connections to the programming interface, and the oscillator pins. Although the microcontroller may operate without an external oscillator for precise and stable timing it is recommended to use a crystal oscillator. We selected an 8 MHz oscillator with 30 pF capacitors, and a 0 Ohm resistor to allow for attenuation of the oscillator signal if required. To reset the microcontroller, we implemented a manual push button switch, as well as following the guidelines for the programmer reset function. This is shown in Fig. 3.3. In addition to the basic requirements an FTDI serial to USB converter chip is connected to the first UART port of the microcontroller to allow for communication to an external device. This feature is primarily used for debugging purposes during development, as well as communication to a single board computer or ground control station during normal operation. This is detailed in the microprocessor sheet of the schematics4 . The microcontroller requires a stable 3.3V power supply, provided by the Texas Instruments LP38690DT-3.3 low dropout voltage regulator. Many sensors and peripherals require 5V operation, and the LP38690DTX-5.0 LDO regulator provides this capability. Because the OSAVC may provide power to an external SBC as well as some high current devices such as servo motors, a Microchip 29300-5.0 5V/3A LDO regulator is used. Finally, the TI PTN78020W switching regulator accepts battery volt-ages in the range of 7-36V and regulates down to 7V/6A, and feeds the two 5V LDO regulators. The switching regular is used because it is very efficient—above 90%—and allows for reducing high battery voltages without wasting energy in the form of heat. The output of the LP38690DTX-5 in turn provides power to the 3.3V LDO.

Alternatively, hydroponic nft system the USB port can power the LP38690DTX-5 and LP38690DT-3.3, typically used when developing and testing firmware. This is switched by a P-channel MOSFET transistor using a voltage divider and comparator circuit when USB power is present detailed in Fig. 3.4. It can also be found in the power section of the schematics. The peripherals supported by the OSAVC are listed in Table 3.1. LEDs indicating communication were placed on signal lines for most sensors5 as well as to indicate the operation of the various voltage sources. A jumper is provided to power the OC modules with the 29300-5.0 and the SBC with up to 3A current at 5V when operated with a battery. The GPIO pins have Schottky diodes to protect the microcontroller from electrostatic discharge events. The detailed design is located in the I/O sheet of the schematics. The guiding principles for the PCB layout balanced phsyical size with manufacturability. Because the design is open source as opposed to a commercial product, we cannot guarantee that an adopter will have access to a reflow oven for soldering components to the PCB. Therefore the design has to support manual soldering while also minimizing board area. Thus, we selected surface mount devices —in order to save board space—that were still possible to solder by hand. As a result, the smallest discrete devices in the design come in the 0603 package, with a footprint of approximately 1.55 by 0.85 mm. For the microcontroller, we selected the TQFP-100 package, which has leads on a 0.5 mm pitch and occupies a 14 mm by 14 mm footprint. we made similar choices for the other components. To ease the assembly all the components are located on the top side of the PCB. For the PCB itself, we also balanced cost vs size by choosing a four layer board. The PCB has two signal planes , an internal ground plane, and an internal 3.3V plane. This design provides some noise immunity by having these mostly complete internal copper planes.we chose to mount the switching power supply on the PCB despite its large size in order to minimize the mechanical complexity. The board could have been made much smaller by placing the power supply separately, but we deemed the convenience of a single PCB worth the tradeoff. The top signal plane and silkscreen of the PCB is shown in Fig. 3.5. For the following discussion refer to the physical board of Fig. 3.6 where the silkscreen designations are easier to see. For the component layout, we chose to have the battery connection enter the PCB from a pair of mounting holes sized for 16 AWG wires on the lower left hand side . Mounted directly adjacent is the PTN78020W . The three LDOs are located along the top and right hand sides of the PTN78020W , and a USB-C power output is located on the upper left hand corner of the PCB . Also on the left hand edge are the motor outputs and GPIO pins located on a 19 by 3 row header. On the top and bottom edges of the PCB are the sensor and peripheral connectors . The microcontroller is located near the center of the PCB . The oscillator is located adjacent to the microcontroller to keep the signal traces short and of nearly equal path length. The EEPROM is located on the lower right of the PCB . On the upper right is the FTDI serial-USB converter which connects to the outside world on the right hand edge of the PCB . The reset button and the in-circuit serial programming port are also located on the right hand edge of the PCB. Refer to the schematics for the location of the various discrete components. For most signals we selected 0.25 mm trace widths matching the lead width of the microcontroller. For higher current carrying traces, such as those from the voltage regulators or battery, we chose traces of at least 1 mm in width—well above the minimum width recommended by the KiCad calculator—in order to minimize resistive losses and to keep the traces as cool as possible. Signal path crossings between the top signal and bottom signal layers were kept as close to perpendicular as was possible to eliminate coupling between signals. There are several tests to perform prior to attempting to load code onto the OSAVC. These tests ensure that the assembly was performed correctly. The first test is to plug a USB-B cable from a computer to the matching receptacle on the OSAVC. This should provide power to the board and the LED from the 3.3V LDO should light up. This indicates that the USB power is succesfully delivered to the regulator and therefore the USB connnector is connected.