1. Fitted basic optical encode circuit to my , now figuring out optimal settings for calculating wheel speed. Notes:

    Sane gurdy speed of 14 revs every 10 seconds = 1.4 RPS
    52 markers on wheel = 52 * 1.4 = 72.8 transitions per second ≈ 73Hz minimal input signal
    
    Timer nominal input freq is Fosc / 4 = 4MHz / 4 = 1Mhz
    Max prescaling = 1:256, i.e. TMR0 increments once for every 256 Fosc/4 pulses
    Resultant timer freq = 1Mhz / 256 = 0.00390625 Mhz = 3906.25 Hz
    
    Input signal has ≈50% duty cycle so periods between pulses should be 1 / 73 = 13.69863014ms
    
    Period of 3906.25Hz wave = 0.256ms
    Num pulses @ 3906.25Hz after 13.7ms = 13.7 / 0.256 = 53.515625
    
    1.4 RPS is minimal normal gurdy trompette playing speed, so counting 54 clicks per transition gives a little space for speeding up and a lot of space for slowing down.
    
    High gurdy trompetting speed of 24 revs per 10 seconds = 2.4 RPS
    TPS = 52 * 2.4 ≈ 124.8 = 125Hz maximum input signal = wavelength of 1 / 125 = 8ms
    Num pulses @ 3906.25Hz after 8ms = 8 / 0.256 = 31.25
    

    So these values should give a just-wide-enough span of ≈20 ticks between nominal and trompetting speed, with room to halve or potentially even quarter the prescaler if this turns out to not be enough. One advantage of these values is space to track much slower wheel movements, opening this up to be used for slower performance tools as well as speed measuring.

    An external switch could always adjust the prescaler if necessary to cover both use cases.

  2. Returned to Iceland to find RTC chip free samples waiting for me @ Vísar HQ, solidifying maximintegrated.com as my favourite semiconductor company — samples shipped to Iceland, of all places, arriving within days of being ordered.

  3. Voltage Dividers

    Working through some example circuit simulations I finally gained an intuitive understanding of the voltage divider equation — it’s just a ratio, but I had never figured this out before.

    Given this circuit, where the voltage source is rated at 1V:

    The voltage at A is equal to 1V·(R2 / R1 + R2), which is 1·(1/1+1) = 1·(1/2) = 0.5.

    Why? Because R1 + R2 represents the total resistance of the path, and as such the total voltage drop. Dividing R2 by the total produces a fraction representing the voltage drop over R2. Multiplying the input voltage by this fraction leaves us with the voltage dropped over just the R2 portion of the circuit, which must be VA because there are no other branches in the circuit.

    Put another way, the equation finds the ratio of resistance (and so voltage drop) R2:R1 and then feeds the input voltage through this. Here’s a more abstract visual representation of what’s going on: