diff --git a/_pages/electrical.md b/_pages/electrical.md
index b6e0b18..7565805 100644
--- a/_pages/electrical.md
+++ b/_pages/electrical.md
@@ -64,6 +64,11 @@ In an early design, both servos were driven using PWM signals generated from the
Instead, we elected to use a PCA9685 I2C servo driver breakout board provided by a member of our team. This driver allows up to 16 servos to be controlled independently, with an onboard clock providing the timing signal for PWM frequency and duty cycle. The PWM duty cycle, which determines servo position, is set by I2C message and is maintained until a subsequent message is received.
Both servos are powered by a dedicated 5V regulator.
+
+
+ {% include figure.liquid loading="eager" path="assets/img/i2c_components_electrical.png" class="img-fluid rounded z-depth-1" zoomable=true %}
+
+
### Beacon Sensing
The beacon sensing subsystem is based on an LTR-3208E phototransistor sourced from our lab kit mounted on the robot swivel. The overall purpose of this circuit is to provide an analog voltage level corresponding to the strength of the 3333 Hz beacon signal received by the phototransistor: this allows the robot to measure the direction of maximum received signal and thereby orient itself relative to the IR beacon.
@@ -78,6 +83,12 @@ The basic sections of the circuit are:
- A final low pass filter to reduce high frequency interference.
- A peak detection circuit, with reset, to provide a smooth analog output voltage to the Arduino.
+
+
+ {% include figure.liquid loading="eager" path="assets/img/ir_sensors_electrical" class="img-fluid rounded z-depth-1" zoomable=true %}
+
+
+
A [Python program](https://github.com/rcollins130/TRACBOT-models) was written to aid in calculation of the required amplification gains, cutoff frequencies, and component values in each stage of the circuit. The [eseries library](https://pypi.org/project/eseries/) was extremely helpful for determining the best combination of resistor and capacitor values to meet gain and frequency specifications.
A video demonstrating use of the beacon sensor for initial orientation is provided in the Results section.
diff --git a/_pages/software.md b/_pages/software.md
index e968ea5..8d64220 100644
--- a/_pages/software.md
+++ b/_pages/software.md
@@ -14,7 +14,11 @@ Our GitHub repository can be found [here](https://github.com/hbuurmei/TRACBOT21-
### State Diagram
---
-[insert state diagram]
+
+
+ {% include figure.liquid loading="eager" path="assets/img/state_diagram.drawio.png" class="img-fluid rounded z-depth-0" zoomable=false %}
+
+
### Libraries
#### TimerInterrupt
@@ -27,11 +31,11 @@ The IMU processing class was developed in-house and inherits the open-source [mp
- ``calibrate()`` reads IMU data for an user specified amount the time. The arithmetic mean of this data is stored as the bias for each sensor. This bias is then used to correct the IMU raw measurements to greatly improve accuracy.
- ``update_integrator()`` is called at a fixed interval by ITimer1 to provide estimates of angles and position/velocity. It works by collecting the current bias-compensated measurements and integrating those measurements via a forward Euler approximation.
-$$\theta_{z,n+1} = \theta_{z,raw}+(\omega_{z,n}-\omega_{z,bias})\Delta t$$
+$$\theta_{z,n+1} = \theta_{z,n}+(\omega_{z,raw}-\omega_{z,bias})\Delta t$$
This function along with the ability to ``reset_integrators()`` is key in measuring our turns to a high degree of precision, necessary for many events in our state diagram.
-### Beacon Processing
+#### Beacon Processing
#### Line Sensor Processing
The line sensor processing was relatively straight forward in our software. We used hysterisis in order to remove chattering around a single threshold, and the min and max thresholds were turned experimentially such that we could detect line crossings. The software also kept running counters of the number of transitions between ``on_line`` and ``off_line`` states which was useful for debugging. The reliability of our sensor meant that this simple software implentation was very reliable, and it did not cause many issues during the project.
diff --git a/assets/img/state_diagram.drawio.png b/assets/img/state_diagram.drawio.png
new file mode 100644
index 0000000..2a8a5d6
Binary files /dev/null and b/assets/img/state_diagram.drawio.png differ
diff --git a/assets/img/state_diagram.png b/assets/img/state_diagram.png
new file mode 100644
index 0000000..1c73f2e
Binary files /dev/null and b/assets/img/state_diagram.png differ