Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
cb17e4f
added gyro sensor
vhoogendijk May 9, 2025
7cfb301
added fixes from testing
vhoogendijk May 9, 2025
56b6923
fixed write to ble blecharacc
vhoogendijk May 12, 2025
4c363b0
added code (rotation around gravity) from pr #35
vhoogendijk May 15, 2025
72091aa
rotation detection and gate execution
vhoogendijk May 15, 2025
e4017f7
arduino sketch to test pauli gates
vhoogendijk May 15, 2025
3eec61c
animation for pauli gates
vhoogendijk May 16, 2025
76cb79b
Make vectors from gravity and gyro
May 16, 2025
c3e643d
Merge pull request #1 from ardjuh/feature/gyro-vector
ardjuh May 16, 2025
f9cf6c7
Add shaking detection
May 16, 2025
50a1743
implemented gates using matrices from Eigen
vhoogendijk May 16, 2025
b484ac4
Merge main
May 16, 2025
555b987
Merge pull request #2 from pitkro/useMatrixGates
ardjuh May 16, 2025
2f29fec
Use tap detection for collapsing
May 16, 2025
c953579
Make accelerometer optional
May 19, 2025
e74fb7d
Switch axis
May 19, 2025
035f7cc
Enable tap freezing
May 19, 2025
31f78df
added partial rotation and animations using matrices
vhoogendijk May 19, 2025
e1b37ee
Merge pull request #3 from pitkro/useMatrixGates
vhoogendijk May 19, 2025
65cd414
added last changes from partial rotations
vhoogendijk May 19, 2025
7f647f1
Make code more clean
May 19, 2025
8765628
Make code more clean
May 19, 2025
248ae6a
Remove unused code
May 19, 2025
ba927d4
rotation of gate matches rotation of turn
vhoogendijk May 20, 2025
8b9f921
Got rid of warning from unit conversion
vhoogendijk May 20, 2025
148ff63
Merge branch 'useMatrixGates'
vhoogendijk May 20, 2025
5a70758
fixed issue when Serial wasn't available
vhoogendijk May 20, 2025
3fd56ff
Move animation to Qbead.h
May 20, 2025
38c1a20
Fix collapsing
May 20, 2025
cadbfb5
Make smooth function more generic
May 22, 2025
e290e77
Improve smoothness
May 22, 2025
9a46f5f
Show decoherence in an example
May 22, 2025
b62c22a
shaking function
vhoogendijk May 23, 2025
26a0704
removed print statements
vhoogendijk May 23, 2025
f47e3cd
Merge branch 'main' of https://github.com/pitkro/firmware
vhoogendijk May 23, 2025
3046e21
Fix collapsing
May 26, 2025
153ce2c
create new src file for ESP32 version
vhoogendijk May 26, 2025
57740b8
Merge branch 'main' of https://github.com/pitkro/firmware
vhoogendijk May 26, 2025
105309a
added last commit to esp version
vhoogendijk May 26, 2025
8f8bd14
Clean code
May 26, 2025
3faeb85
Clean code
May 26, 2025
faab17c
Remove bluetooth from esp 32 version code
May 26, 2025
28743a1
Generate coordinates map
May 27, 2025
01d9e9f
Add todo
May 27, 2025
1ba78a6
Add todo
May 27, 2025
55debe5
Code can now be uploaded to the esp32
May 27, 2025
92cfed0
Reduce decoherence to 1 axis and implement dynamic decoupling
May 27, 2025
db30d1d
added simple esp32 BLE
vhoogendijk May 27, 2025
e422c5e
added simple esp32 BLE
vhoogendijk May 27, 2025
2db0fa7
Merge branch 'add/BLE_ESP32' of https://github.com/pitkro/firmware in…
vhoogendijk May 27, 2025
54ddb2d
Remove all i2c
May 28, 2025
8efa27b
Use correct pin
May 28, 2025
6bbfa58
added simple esp32 BLE
vhoogendijk May 27, 2025
376fb97
Merge branch 'add/BLE_ESP32' of https://github.com/pitkro/firmware in…
vhoogendijk May 28, 2025
36dd75a
WIP BLE ESP32
vhoogendijk May 28, 2025
b96193c
Merge remote-tracking branch 'origin/main' into add/BLE_ESP32
vhoogendijk May 28, 2025
c2775ed
BLE code compiled(But doesn't run properly)
vhoogendijk May 28, 2025
02a2876
Simplify collapsing
Jun 2, 2025
19f1eae
working BLE on esp32
vhoogendijk Jun 3, 2025
c0cf037
added descriptors to allow for notifications and identification of char
vhoogendijk Jun 3, 2025
17055bc
Merge pull request #5 from pitkro/add/BLE_ESP32
vhoogendijk Jun 3, 2025
a986a95
Enable imu
Jun 3, 2025
464da99
Fix merge
Jun 3, 2025
20396fe
Set led pin
Jun 3, 2025
7ad57f2
Use correct imu driver
Jun 4, 2025
569fea3
Fix some imu issues
Jun 5, 2025
83c0b6d
Add acc
Jun 6, 2025
98efca0
Fix shaking
Jun 6, 2025
ea0ddc8
Fix imu sometimes not working
Jun 6, 2025
1372cf1
Fix shaking
Jun 10, 2025
d5a0bb6
Add double tap support
Jun 10, 2025
ac4fe6e
Simplify tap detection
Jun 10, 2025
a6c78ba
Improve shaking
Jun 10, 2025
53d7a33
Improve shake detection
Jun 16, 2025
f1cc8a6
Make code faster
Jun 23, 2025
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
86 changes: 86 additions & 0 deletions examples/Decoherence/Decoherence.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#include <Qbead.h>

Qbead::Qbead bead;
int rotationState = 0;
uint32_t stateColor = color(255, 255, 255);
uint32_t decoherenceColor = color(122, 0, 122);
const bool toggleAnimationOn = 1;
Qbead::Coordinates oldCoordinates(0, 0, 1);
int t = 0;
bool wasFrozen = false;

void setup()
{
bead.begin();
bead.setBrightness(25);
Serial.println("testing all pixels discretely");
for (int i = 0; i < bead.pixels.numPixels(); i++)
{
bead.pixels.setPixelColor(i, color(255, 255, 255));
bead.pixels.show();
delay(5);
}
Serial.println("testing smooth transition between pixels");
for (int phi = 0; phi < 360; phi += 30)
{
for (int theta = 0; theta < 180; theta += 3)
{
bead.clear();
bead.setBloch_deg(theta, phi, colorWheel_deg(phi));
bead.show();
}
}
Serial.println("starting inertial tracking");
oldCoordinates = bead.state.getCoordinates();
t = millis();
}

void loop()
{
bead.readIMU(true);
stateColor = color(255, 255, 255);
Serial.print("rotationState: ");
Serial.println(rotationState);
if (bead.frozen)
{
stateColor = color(122, 122, 0);
wasFrozen = true;
}
else
{
if (wasFrozen)
{
wasFrozen = false;
oldCoordinates = bead.state.getCoordinates();
}
rotationState = bead.checkMotion();
if (rotationState != 0)
{
bead.frozen = true;
bead.T_freeze = millis();
}
float phi = bead.state.getCoordinates().phi();
int dt = millis() - t;
float randInt = random(200, 10000);
phi += dt / randInt;
if (phi > 2 * PI)
{
phi -= 2 * PI;
}
Qbead::Coordinates newCoordinates(bead.state.getCoordinates().theta(), phi);
bead.state.setCoordinates(newCoordinates);
bead.visualState = bead.state.getCoordinates();
}
t = millis();
bead.animateTo(rotationState, 2000);
if (bead.T_led + 20 < millis()) {
bead.T_led = millis();
bead.clear();
if (!bead.frozen) {
bead.setLed(oldCoordinates, decoherenceColor);
}
bead.showAxis();
bead.setLed(bead.visualState, stateColor, 1);
bead.show();
}
}
2 changes: 1 addition & 1 deletion examples/IMU_reader/IMU_reader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ void setup() {
void loop() {
bead.readIMU();
bead.clear();
bead.setBloch_deg_smooth(bead.t_acc, bead.p_acc, color(255, 0, 255));
bead.setLed(Qbead::Coordinates(bead.gravityVector), color(255, 0, 255), true);
bead.show();
}
54 changes: 54 additions & 0 deletions examples/PauliGate_detection/PauliGate_detection.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include <Qbead.h>

Qbead::Qbead bead;
int rotationState = 0;
uint32_t stateColor = color(255, 255, 255);
const bool toggleAnimationOn = 1;

void setup() {
bead.begin();
bead.setBrightness(25); // way too bright
Serial.println("testing all pixels discretely");
for (int i = 0; i < bead.pixels.numPixels(); i++) {
bead.pixels.setPixelColor(i, color(255, 255, 255));
bead.pixels.show();
delay(5);
}
Serial.println("testing smooth transition between pixels");
for (int phi = 0; phi < 360; phi += 30) {
for (int theta = 0; theta < 180; theta += 3) {
bead.setBloch_deg(theta, phi, colorWheel_deg(phi));
bead.show();
}
}
Serial.println("starting inertial tracking");
}

void loop() {
bead.readIMU(false);
stateColor = color(255, 255, 255);
Serial.print("rotationState: ");
Serial.println(rotationState);
if (bead.frozen)
{
stateColor = color(122, 122, 0);
}
else
{
rotationState = bead.checkMotion();
if (rotationState != 0)
{
bead.frozen = true;
bead.T_freeze = millis();
}
}
bead.animateTo(rotationState, 2000);
// The leds can only be updated every 20ms
if (bead.T_led + 20 < millis()) {
bead.T_led = millis();
bead.clear();
bead.showAxis();
bead.setLed(bead.visualState, stateColor);
bead.show();
}
}
46 changes: 46 additions & 0 deletions generateCoordinates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This is a script to convert the pick and place file to a coordinates map
# This code is very much not optimized, but it does its job.

import math

inputFile = "../pick-and-place.csv"
outputFile = "../pick-and-place-coordinates.csv"

lines = []

with open(inputFile, 'r') as file:
for line in file:
if line.strip(): # Check if the line is not empty
lines.append(line.strip())

x0 = float(lines[0].split(',')[3])
y0 = float(lines[0].split(',')[4])

coordinates = []
for line in lines:
parts = line.split(',')
if len(parts) >= 2:
x = float(parts[3]) - x0
y = float(parts[4]) - y0
coordinates.append((x, y))

# Convert to spherical coordinates
spherical_coordinates = []
for x, y in coordinates:
r = (x**2 + y**2)**0.5
phi = math.atan2(y, x) # angle in radians
if phi < 0:
phi += 2 * math.pi # Normalize angle to [0, 2π)
spherical_coordinates.append((r, phi))

# scale r from 0 to pi
scaled_coordinates = []
for r, phi in spherical_coordinates:
scaled_r = r / max(r for r, _ in spherical_coordinates) * math.pi
scaled_coordinates.append((round(scaled_r, 2), round(phi, 2)))

# Write to output file
with open(outputFile, 'w') as file:
for theta, phi in scaled_coordinates:
file.write(f"Coordinates({theta}, {phi}),\n")
print(f"Coordinates written to {outputFile}")
Loading