MustafaMulla29/rp2040-bldc-motor-controller
Hardware assembly metadata and PCB geometry for a controller board with a snap-off rotary-encoder section, plus four parallel 150 µF/50 V bulk electrolytic capacitors filtering the motor supply.
- Version
- 2.0.40
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone MustafaMulla29/rp2040-bldc-motor-controller # download the package files into ./rp2040-bldc-motor-controller
tsci add MustafaMulla29/rp2040-bldc-motor-controller # add it to your project as @tsci/MustafaMulla29.rp2040-bldc-motor-controllerIn a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.
firmware/test_feedback.py
import unittest
from feedback import Quadrature
class FeedbackTests(unittest.TestCase):
def test_direction_and_four_counts_per_cycle(self):
q = Quadrature(0, 0)
for state in [(0,1),(1,1),(1,0),(0,0)] * 10:
q.sample(*state)
self.assertEqual((q.count, q.invalid), (40, 0))
for state in [(1,0),(1,1),(0,1),(0,0)] * 10:
q.sample(*state)
self.assertEqual((q.count, q.invalid), (0, 0))
def test_invalid_transition_does_not_invent_motion(self):
q = Quadrature(0, 0)
q.sample(1, 1)
self.assertEqual((q.count, q.invalid), (0, 1))
q.sample(1, 0)
self.assertEqual(q.count, 1)
def test_contact_bounce_returns_to_same_count(self):
q = Quadrature(0, 0)
for state in [(0,1),(0,0)] * 20:
q.sample(*state)
self.assertEqual((q.count, q.invalid), (0, 0))