E-Bike Speed Divide by 2 Flip Flop One-Shot

Thread Starter

hinky99

Joined Aug 5, 2019
6
E-Bike Speed Divide by 2 Flip Flop One-Shot Project
20201002,JWH

Notes:
1. Signal pulse and count used as interchangeable terms here
2. Working prototype uses CD4013 IC Chip but requires additional voltage source (see requirement #2)
3. 74HC series chip likely better fit for 3.3V control
4. Control (MCU) reads half actually speed resulting in pedal assist enabled at 2X actual wheel velocity

Fixed Hardware:
1. Magnet actuator (Cyclometer Speed Magnet)
2. Pick-up (N.O. Reed Switch)
3. Motor control unit MCU (Pin1 3.3 VDD RED) (Pin2 COM BLK)

Requirements:
1. Output 1 pulse for every 2 input counts
2. Circuit VDD same wire as signal (no external voltage source)
3. Short-to-Ground (Pin 1 touches Pin 2) = 1 input signal (negative edge trigger)

Extra Bonus:
1. Momentary push button to toggle between 1:1 mode and 2:1 mode
2. "Fail safe" IC defaults to 1:1 mode


Similar product that accomplishes task through Amtel Chip
https://www.ebiketuning.com/comparison/bosch-gen2-tuning.html

Normal Operation: 1:1
Pick-up to MCU
¯¯¯¯¯¯¯¯¯|__|¯¯¯¯¯¯¯¯¯¯¯¯¯|__|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|__|¯¯¯¯¯¯¯¯¯¯¯¯¯¯|__|¯¯¯¯¯¯¯¯¯¯¯

Functional Operation: 2:1 latching
Prototype 4013
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|____________________________________|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Desired Operation: 2:1 pulsed
IC output MCU (clocked by Pick-up)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|__|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|__|¯¯¯¯¯¯¯¯¯¯¯

Request:
Provide guidance, recommendations or schematic on how to accomplish stated objective
 

Attachments

MrChips

Joined Oct 2, 2009
22,099
Is this a personal project or is this school assignment?

You can do this with two or three CMOS logic ICs.
Or you can get everything you need and more with a single MCU IC.
Take your pick.
 

Irving

Joined Jan 30, 2016
1,069
Use the neg edge output of the flip-flip to trigger a monostable to produce the required output pulse - eg 74HC123.

1-wire slightly more tricky, what is pulse rate? Something like this would work....

1601672855044.png

Requirement 3:
Push button used to trigger 2nd half of HC123 to put a longer 0v pulse on wire, then another HC123 at other end to recognise longer pulse.

Bonus stuff...
By now probably easier to use low-power MCU to do pulse timing and other logic... 8-pin MCU from Microchip, STM, etc...
Pulse_In
Pulse_Out
Button1
Button2
VCC
GND
+2 spare GPIO
 

Thread Starter

hinky99

Joined Aug 5, 2019
6
Please forgive incorrect usage of MCU: Motor Control Unit ≠ Microcontroller

Pulse frequency is 200-300ms MAX

Requirement 3 describes how the a typical signal is generated and detected by the Motor Control Unit

Personal project
 

Thread Starter

hinky99

Joined Aug 5, 2019
6
The schematic of the 1-wire from 74HC123 idea is helpful.
Can you please see below for the idea on integrating the other logic devices?
Will this circuit accomplish the implementation of a divide-by-two, one-shot, with 1-wire for power and signal?

E-FLIP-ONE-SHOT.png
 

Attachments

Janis59

Joined Aug 21, 2017
1,232
I may easily understand any need to multiply e-byke speed within factor of 2, but to decrease it.... its nonsense.
 

Thread Starter

hinky99

Joined Aug 5, 2019
6
I may easily understand any need to multiply e-byke speed within factor of 2, but to decrease it.... its nonsense.
The mid-drive unit is pedal assist up to 20mph / 32kmh. It looks for primarily 2 things when determining "assist".
1. Torque (translated through a strain gauge) motor enable and power level output
2. Velocity (feedback from the magnetic reed switch) factory set control parameter for the wheel circumference

The intent is doubling the speed at which assist will be provided. By halving input pulses, pedal assist will be enabled up to 40mph / 64kmh.
 

Thread Starter

hinky99

Joined Aug 5, 2019
6
Is anyone able to provide guidance on the layout below:
1602010905752.png
If this is not being posted in the correct form, please direct me.
 

Irving

Joined Jan 30, 2016
1,069
I'm slightly confused... is the pulse signalling going up from the motor (connected at X1-1/X1-2) to the control unit, and the power coming down?

If so, I'm not sure about the connection at X1-1. We need to ensure power down the line without compromising the VCC line, and also prevent signalling into X1-1 getting to X2-1.

Also the VCC line of both IC should be connected to the junction of R1/D1/C1 not to the collector of T1.

I havent checked the datasheet for the HC123, but the values for R4 & C3 intuitively look wrong for the expected pulse width....
 

Thread Starter

hinky99

Joined Aug 5, 2019
6
I'm slightly confused... is the pulse signalling going up from the motor (connected at X1-1/X1-2) to the control unit, and the power coming down?

If so, I'm not sure about the connection at X1-1. We need to ensure power down the line without compromising the VCC line, and also prevent signalling into X1-1 getting to X2-1.

Also the VCC line of both IC should be connected to the junction of R1/D1/C1 not to the collector of T1.

I havent checked the datasheet for the HC123, but the values for R4 & C3 intuitively look wrong for the expected pulse width....
The magnetic reed switch is the physical switch (not a board level component). X1-1/X1-2 pins are not connected until the magnet mounted to a spoke passes the reed switch X1-1/X1-2 closes and an input signal is created.

I may have misunderstood your example of a 1-wire circuit. The signal wire needs to be the same as VCC.

The output pulse width from HC123 is not very critical. It just needs to be long enough for VCC to be pulled low. (short to ground). The input frequency (at the reed switch) is estimated to be 200ms max. wheel rotate 5 times per second means 30+ mpg
 

Irving

Joined Jan 30, 2016
1,069
The magnetic reed switch is the physical switch (not a board level component). X1-1/X1-2 pins are not connected until the magnet mounted to a spoke passes the reed switch X1-1/X1-2 closes and an input signal is created.

The output pulse width from HC123 is not very critical. It just needs to be long enough for VCC to be pulled low. (short to ground). The input frequency (at the reed switch) is estimated to be 200ms max. wheel rotate 5 times per second means 30+ mpg
Ah I understand now. Then that's correct wiring for X1-1. I thought there was more active circuitry down-stream of this circuit. So really this isn't a 1-wire, its just a remote switch - there is nothing needing power in the original setup - you're turning it into a 1-wire to power your additional circuit.
But the pulse repetion rate isn't the issue, its the pulse width (low time). that matters mostly in a 1-wire circuit.

I may have misunderstood your example of a 1-wire circuit. The signal wire needs to be the same as VCC.
No, what I drew is correct. Don't confuse signalling+power on the 1-wire (hence 1-wire) with the internal use of the power. Diode D1 allows current from the 1-wire to charge C1, but prevents the transistor T1 discharging C1 when it sends the pulse. C1 maintains power to U1 & U2 on the internal VCC line during the pulse low time. R1 is technically not needed as its acting as a pullup for the 1-wire which has its own pullup feeding the 1-wire, however it adds a little noise immunity.

C1 is sized to keep the internal VCC up during the pulse - its good for around 65mS for <0.1v drop. Assuming a 700c tyre, 5revs/sec = 25mph, the input pulse width for a 1cm dia spoke magnet 30% out from the centre (typical location on my bike) is around 3mS at 25mph (pulse rate 200mS) and 7.5mS at 10mph (500mS pulse rate). Assuming output pulse width approx 10mS (R4=100k, C3 = 220nF), 65mS hold-up is fine.
 

Irving

Joined Jan 30, 2016
1,069
Here's a suggestion.
I'm not sure why the HC123 is needed but it can be tacked on at the end of this circuit if needed.
The momentary PB will will toggle the output between 1X and 0.5X pulse frequency. Requires 4 chips.

View attachment 219076
The TS is using a 4013 D-type flip-flop to toggle on the input pulse and then using the /Q output to trigger the HC123 to generate a suitable width output pulse at 1/2 the input pulse rate. Only requires 2 chips.
 

soyez

Joined Aug 17, 2020
51
At the point when the switch is shut the capacitor is shortcircuited and accordingly releases while simultaneously the door of the MOSFET is shorted to ground. The MOSFET and thusly the LED are both exchanged "OFF". While the switch is shut the circuit will consistently be "OFF" and in its "temperamental state".
 

Irving

Joined Jan 30, 2016
1,069
At the point when the switch is shut the capacitor is shortcircuited and accordingly releases while simultaneously the door of the MOSFET is shorted to ground. The MOSFET and thusly the LED are both exchanged "OFF". While the switch is shut the circuit will consistently be "OFF" and in its "temperamental state".
Err, what MOSFET & what LED?
 
Top