Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit VL53L1x project #114

Merged
merged 3 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions projects/Thomas_VL53L1x_pwm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: "Thomas Anderson"
slack_handle: "Thomas Anderson"
github_handle: "tandej"
project: "VL53L1x_pwm"
---

# VL53L1x_pwm
## Summary
The VL53L1x and company are great sensors with a lot of utility, but the I2C protocol and required device drivers can be quite clumsy in certain applications. This board uses a STM32 microcontroller in a very small form factor to adapt from that protocol to a standard duty-cycle output at the logic level that it is powered with.

## Fabrication
Gerber files, BOM and component placement files can be found in /VL53L1x_pwm/JLC_output. To ensure that those files are up-to-date with the source, run:
```
$ pip3 install kikit
$ chmod +x VL53L1x_pwm/KiKitJLCGen.sh
$ VL53L1x_pwm/KiKitJLCGen.sh
```
The shell script can trivially be converted to a batchfile for Windows users.

JLC's SMT assembly GUI doesn't automatically assign a part for a few parts. I used NX3225SA-16MHZ-EXS00A-CS10477 for crystal Y1 and X1270WV-2x05B-6TV01 for connector J1. Otherwise, generic passive components like resistors and capacitors generally have no requirements other than their footprint and value (capacitor C1 needs to be rated for 16v).

## Plan
![cart](cart.png)

The boards are quite small and only 2-layer, so the cost comes to only $4 for all 5 boards. The assembly takes up most of the budget, coming to $75.86. Shipping wasn't shown, but I expect it to cost <$20 given the size of the boards and prior experience with JLC.

The board is pretty much done after I recieve it, so all I have to do is write the firmware for the device. That should be quite easy with STM32duino and an STLink for SWD programming.

## Design
![schematic](VL53L1x_pwm.png)

I started this project planning to use the VL53C4x sensor for its slightly better performance. I also planned to use a small-form-factor STM32 for the ease of programming that it offered and prior personal experience with STM32F04 and F09 ARM M0 processors.

At this point I ran into a conflict between a small, inexpensive microcontroller and VL53C4x, as I found that the (required) STM device drivers used upwards of 50 kB of flash memory, which was well over total internal flash budget. If I had more experience with embedded development, I probably could have made this work with execute-in-place on a SPI external flash chip, but I didn't really think that was feasible.

Pivoting to the VL53L1x, my job was a lot easier as the drivers only use \~2.3 kB of flash. The VL53L1x specifically operates at 1.6v\~2.8v logic level, which drove my choice specifically to the STM32L011k for its 1.8v operating level. Doing an I2C shift would be possible, but would introduce a lot of potential problems with high-speed communications. Just shifting SWD and the PWM output would be a lot easier.

A last-minute addition was the INT (interrupt) output pin, as I realized that the sensor update rates weren't quite as good as I thought, and so downstream devices could easily find a notification of new updates useful.

---

[X] I am a current high school, middle school, or home schooled student.

[X] I have filled out the [verification form](https://airtable.com/shrbcDANe6ug6gj0p)

[X] I have joined the [`#onboard`](https://hackclub.slack.com/archives/C056AMWSFKJ) channel on Slack

[X] I made this board from scratch, even if I followed a tutorial

[X] I have followed [DIRECTIONS.md](https://github.com/hackclub/OnBoard/directions.md)

[X] Created a folder under `onboard/projects`

[X] Filled out `TEMPLATE.md`

[X] Uploaded Gerber and design files

[X] Uploaded screen shot of PCB passing vendor inspection

[X] I am ordering the smallest batch size (ie. JLCPCB's smallest order is for 5 boards)

[X] If outside the US I've checked that I can afford the customs charges in my country (which isn't covered by the grant)
Binary file added projects/Thomas_VL53L1x_pwm/VL53L1x_pwm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions projects/Thomas_VL53L1x_pwm/VL53L1x_pwm/JLC_output/bom.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Comment,Designator,Footprint,LCSC
1 uF,C1,Capacitor_SMD:C_0402_1005Metric,
10 pF,"C2,C9",Capacitor_SMD:C_0402_1005Metric,
0.1 uF,"C3,C4,C5,C11",Capacitor_SMD:C_0402_1005Metric,
4.7 uF,"C6,C8,C10",Capacitor_SMD:C_0603_1608Metric,
10 nF,C7,Capacitor_SMD:C_0402_1005Metric,
D_Schottky,D1,Diode_SMD:D_SOD-323F,
Conn_02x05_Odd_Even,J1,Connector_PinHeader_1.27mm:PinHeader_2x05_P1.27mm_Vertical,
BSS138,"Q1,Q2,Q3,Q4",Package_TO_SOT_SMD:SOT-23,
10k,"R1,R2,R3,R4",Resistor_SMD:R_0402_1005Metric,
LP2985-1.8,U1,Package_TO_SOT_SMD:SOT-23-5,
STM32L011D4Px,U2,Package_SO:TSSOP-14_4.4x5mm_P0.65mm,
VL53L1CXV0FY1,U3,Sensor_Distance:ST_VL53L1x,
16 MHz 9 pF,Y1,Crystal:Crystal_SMD_3225-4Pin_3.2x2.5mm,
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,6.0.11-2627ca5db0~126~ubuntu22.04.1*
G04 #@! TF.CreationDate,2023-06-19T15:46:02-07:00*
G04 #@! TF.ProjectId,VL53L1x_pwm,564c3533-4c31-4785-9f70-776d2e6b6963,rev?*
G04 #@! TF.SameCoordinates,Original*
G04 #@! TF.FileFunction,Other,Comment*
%FSLAX46Y46*%
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
G04 Created by KiCad (PCBNEW 6.0.11-2627ca5db0~126~ubuntu22.04.1) date 2023-06-19 15:46:02*
%MOMM*%
%LPD*%
G01*
G04 APERTURE LIST*
%ADD10C,0.150000*%
G04 APERTURE END LIST*
D10*
G04 #@! TO.C,REF\u002A\u002A*
X124200000Y-108500000D02*
G75*
G03*
X124200000Y-108500000I-3200000J0D01*
G01*
X124200000Y-89500000D02*
G75*
G03*
X124200000Y-89500000I-3200000J0D01*
G01*
X150200000Y-108500000D02*
G75*
G03*
X150200000Y-108500000I-3200000J0D01*
G01*
X150200000Y-89500000D02*
G75*
G03*
X150200000Y-89500000I-3200000J0D01*
G01*
G04 #@! TD*
M02*
Loading