-
Notifications
You must be signed in to change notification settings - Fork 0
Home
andrew700andrew edited this page Mar 19, 2018
·
4 revisions
LEFT TO RIGHT (1, 2, 3)
- pin 1 goes to 5 V on Uno (min=3.8 V)
- pin 2 goes to ground on Uno
- pin 3 is connected to pin 3 on Uno (Must be interrupt. pin 3 or 2 are interrupt pins on Uno, this is defined at top of code) and via a 24k pullup to whatever logic level the Arduino operates at (5V for Uno). Max current is 20 mA so calculate pullup accordingly.
Attach magnet to a rotating part of the drivetrain. Program assumes 1:1 wheel rotation to magnetic pulse. See diagram for North/South alignment.
See code for detentions to define.
Hall sensor pulls data pin to ground when magnet close. A falling edge interrupt routine is ran that saves the time of the pulse. Once per loop the program senses whether the ISR was run and if so calculates a new speed. Note that program must loop at least once per revolution so that pulse is counted and speed calculated. Therefore code that hangs the program is not suitable.