logo elektroda
logo elektroda
X
logo elektroda

Rectangular generator for the bicycle PAS sensor

yogi009  14 4560 Cool? (+11)
📢 Listen (AI):

TL;DR

  • A tiny self-contained square-wave generator was built to emulate a bicycle PAS sensor for diagnosing the controller or providing a backup pedal-signal source.
  • The circuit uses an adjustable RC oscillator with a 4.7uF capacitor and resistor values that can be changed, and it provides both the pulse and its inversion.
  • Oscilloscope testing showed 6.4 Hz with 20% duty cycle on one output and 80% on the other.
  • The module worked well in practice and can plug into the controller's three-wire PAS harness: +5V, ground, and rectangular signal.
Generated by the language model.
Small PCB with electronic components for bike assistance, next to a matchstick for scale.

A few years ago I electrified my old Dutch bicycle. Regulation motor, regulation method of control based on detecting the rotational movement of the pedals. The principle is simple: you turn the pedals, the motor supports you a little (the level of support can be set). You don`t shoot, you don`t drive :-) On the pedal support axis there is a PAS sensor and a wheel with a certain number of magnets. Turning the pedals moves these magnets over the PAS sensor (or, more precisely, over the two Hall sensors that detect the magnetic field). In simple terms, the PAS sensor "produces" a rectangular digital waveform (i.e. alternating "high" and "low" logic states). Empirical measurements have shown that a good frequency of these pulses is around 6-7 Hz (then the rest of the bike`s electronics feel good). I also made the PAS sensor for this electrification myself, because... original chinese (but it was an oxymoron) it started the engine even when I turned the pedals... backwards. By the way, the filling of the rectangle is responsible for detecting the direction of rotation of the pedals - it should be significantly different from 50%.

Last summer, the power steering failed, I removed it and rode without it. But it`s winter, so I have some time to analyze the extent of the damage. Generally, I assume two possibilities: the main Chinese controller is dead (and then it fails), or my PAS sensor is dead (or making another copy is simple and cheap). In order to diagnose it, you need to feed this square wave (approx. 6-7 Hz) to one of the inputs of the main controller. I could do this using a service generator, but I decided it would be better to make a small, self-contained generator board. It will allow me to diagnose damage to the PAS sensor, but it will also serve as a backup source of the square wave signal in case my pedal sensor fails, e.g. 45 km from home. In this case, just plug in this little "device" and the bike "thinks I`m turning the pedals" :-) This is a form of fraud.

Here we have a diagram, a preview drawing of the board and the PCB with the elements themselves (Top layer). As you can see, this is a really small module.

Electrical schematic of a homemade square wave signal generator. PCB layout of a small pulse generator. Diagram and drawing of a PCB with components marked as Top layer.

Well, today I finally launched my small but very useful project. Oscilloscope measurements showed that the results are very good, I measured a frequency of 6.4 Hz with a duty cycle of 20% on one output and 80% on the alternative output.

So I already have the test module, all I need to do is assemble the bike`s support elements and perform a diagnosis of the whole thing. I recommend this "rescue" module to everyone who has this type of drive. Controllers usually have one harness for the PAS sensor (three wires: +5V, ground and rectangular signal). In this project, we have two outputs to choose from: a signal with a 20% duty cycle and its inversion (i.e. an 80% duty cycle) - I added the second output due to different interpretations of the signal by different controller models.

If you look at the diagram, it is easy to see that by changing the 4.7uF capacitor and the values of both resistors (you can also draw potentiometers here), we will determine the frequency and filling of the rectangle we need.. So this is quite a useful diagram. The construction cost is practically non-existent.

Please don`t be picky about the photo, this time it was taken with a cell phone, and it`s a test module, so it`s a bit snotty with tin - these tests have to be done somehow. :-)

Edit:
The module has proven to be excellent in practice.

About Author
yogi009 wrote 14693 posts with rating 2650 , helped 848 times. Been with us since 2006 year.

Comments

krzbor 08 Feb 2024 13:54

Personally, I would connect one of the free gates to the "reverse output" and then the "output" would be created from it. In such a case, the generator itself would not have an external outlet - nothing... [Read more]

yogi009 08 Feb 2024 14:00

In its current shape, the first gate ends with a TTL output, the second one was used as an inverter and here we have an inverted signal. In the PAS system, similarly to PWM control, the bypass currents... [Read more]

Anonymous 08 Feb 2024 15:19

An alternative is to connect the shifter in addition to the PAS sensor, many Chinese controllers have the ability to use both. I understand that then it will be an illegal method of control - but in fact,... [Read more]

yogi009 08 Feb 2024 16:58

Illegal is one thing and uncomfortable is two. My friend doesn`t know the principles of these PAS systems. The frequency and width of the pulses are not linearly translated into support force or speed.... [Read more]

Anonymous 08 Feb 2024 17:03

ok, although I have the impression that this is not the case everywhere - in the bike that I built using a Chinese controller, the speed of turning the pedals affects the support, i.e. turning the pedals... [Read more]

yogi009 08 Feb 2024 17:06

I won t really see the possibility of such control. A strain gauge sensor installed in the bottom bracket is still needed. Unless the set includes a ready-made support with a strain gauge sensor and the... [Read more]

Anonymous 08 Feb 2024 17:24

I don m far from insisting, there are thousands of no-name controllers from Aliexpress, I don`t even know the name of my model. In any case, it responds to the speed of turning the pedals, i.e. to the... [Read more]

yogi009 08 Feb 2024 18:43

This is a big disadvantage. Imagine that you are standing at a red light and you involuntarily turn your pedals backwards... And the bike lurches forward. This was the reason for me to make my own PAS... [Read more]

Ryszard1960m 09 Feb 2024 10:02

chart [Read more]

Mastertech 09 Feb 2024 15:46

That`s why you have a sensor on each brake lever that will disconnect the drive when it detects a low condition (brake LOW) I also converted a Dutch one into a Chinese one, twice, because the first one... [Read more]

yogi009 09 Feb 2024 16:50

I don t moved the pedals when braking for years :-) Added after 20 [minutes]: I don`t really feel the logical need for such a function, but if it is useful to someone... My PAS sensor project... [Read more]

rafcio363 11 Feb 2024 17:30

How is that possible without Arduino? [Read more]

yogi009 11 Feb 2024 18:00

Well, I don`t know, it just worked out that way... sorry :-) [Read more]

Mastertech 11 Feb 2024 22:22

I will make one on Arduino, I will implement Police Mo0de, which will turn the bike into an angel when I get off the saddle. They have taken up scooters with saddles and bicycles with levers like never... [Read more]

FAQ

TL;DR: At 6.4 Hz, this small PAS simulator gives 20% or 80% duty cycle outputs; as the author put it, "the module has proven to be excellent in practice." It helps e-bike owners diagnose whether a 3-wire PAS line or the main controller has failed, and it can work as an emergency get-home signal source. [#20949922]

Why it matters: A tiny square-wave generator can separate PAS-sensor faults from controller faults and restore basic pedal-assist when a bike fails far from home.

Option Signal shape Main use Reported benefit
PAS simulator output A 20% duty, about 6.4 Hz Controller test or backup ride-home signal Matches controllers that expect one pulse polarity
PAS simulator output B 80% duty, inverted Compatibility with other controller interpretations Covers controllers preferring the opposite logic
Basic PAS cadence sensing Non-50% square wave Detects pedaling and direction Simple, cheap, works with 3-wire PAS harness
Strain-gauge bottom bracket Force-sensitive input Measures pedal pressure Enables torque-based support behavior

Key insight: The most important design rule is not frequency alone. The PAS waveform must stay clearly away from 50% duty cycle, because the controller can use high/low timing asymmetry to recognize pedal direction. [#20951631]

Quick Facts

  • The finished generator measured 6.4 Hz, with one output at 20% duty cycle and the inverted output at 80%. [#20949922]
  • Typical PAS wiring here uses 3 wires: +5 V, ground, and square-wave signal, which makes the module easy to plug into many controllers. [#20949922]
  • The original DIY PAS sensor used two Hall sensors spaced by about 5 mm to detect pedal direction from relative timing. [#20953244]
  • The author built the module as a diagnostic tool and as a backup for failures as far as 45 km from home. [#20949922]
  • In one practical PAS setup, motor restart after pedaling can lag by about two full crank turns, which motivated ideas for delayed cutoff and reverse-triggered disable. [#20953180]

How do I build a small rectangular pulse generator to simulate a bicycle PAS sensor for diagnosing an e-bike controller?

Build a small logic-gate oscillator that outputs a PAS-like square wave at about 6–7 Hz. Use an RC timing network, power it from the controller’s +5 V PAS line, and bring out both the direct and inverted outputs so you can test 20% and 80% duty-cycle variants. The thread’s version was made as a tiny standalone PCB for diagnosis and emergency use. It plugs into the usual 3-wire PAS harness: supply, ground, and signal. [#20949922]

What is a PAS sensor in an e-bike, and how does it generate a square-wave signal from pedal movement?

A PAS sensor is the pedal-assist sensor that tells the controller the cranks are turning. "PAS sensor" is a pedal-cadence sensor that detects crank rotation with magnets and Hall elements, producing a digital square wave whose timing can also reveal direction. In this thread, magnets pass over two Hall sensors, and their switching creates alternating high and low states. The controller reads that square wave and enables motor support when pedaling is detected. [#20949922]

Why does the duty cycle of the PAS square wave need to be far from 50% to detect pedal rotation direction?

The duty cycle must stay far from 50% because the controller can compare high and low durations to infer direction. If the waveform were near a perfect 50/50 split, forward and reverse timing would look too similar. The author states that the system uses the unequal lengths of high and low states, rather than only edge counting, to distinguish pedal direction. That is why his generator provides strongly asymmetric outputs such as 20% and 80%. [#20951631]

How can I choose the resistor and capacitor values to get about 6–7 Hz from a PAS signal generator?

Choose the RC values empirically so the oscillator lands near 6–7 Hz. The thread gives one proven capacitor value of 4.7 µF and says changing that capacitor plus both resistor values sets frequency and duty cycle. A practical method is: 1. start from the shown 4.7 µF timing capacitor, 2. adjust the two resistors to shape frequency and fill, 3. confirm with an oscilloscope until you read about 6.4 Hz. Potentiometers can replace fixed resistors during tuning. [#20949922]

What is the difference between a 20% and 80% duty-cycle PAS output, and why do some controllers prefer one over the other?

The 20% output is the base PAS-like waveform, and the 80% output is simply its inversion. Both carry the same approximate frequency, but they present opposite logic timing to the controller. The author added both because different controllers interpret PAS polarity differently, so one model may accept the 20% waveform while another prefers the 80% version. Offering both outputs increases compatibility without changing the rest of the module. [#20949922]

How do I test whether an e-bike failure is caused by the PAS sensor or the main Chinese controller?

Inject a known-good PAS square wave into the controller and watch whether assist returns. If a stable test signal of about 6–7 Hz restores operation, the PAS sensor path is the likely fault; if nothing changes, the main controller is the stronger suspect. The author built this exact module for that split diagnosis and also kept it as a backup signal source for roadside failures. The intended connection point is the controller’s PAS input on the 3-wire harness. [#20949922]

What is a strain gauge sensor in an e-bike bottom bracket, and how is it different from a basic PAS cadence sensor?

A strain gauge sensor measures pedal force, while a basic PAS sensor mainly detects that pedaling is happening. "Strain gauge sensor" is a bottom-bracket force sensor that measures pedal load, unlike a cadence PAS sensor whose main job is detecting rotation and timing, not rider torque. The thread says newer assist systems use strain gauges so stronger pedal pressure produces stronger support. By contrast, the author’s classic setup relies on a square-wave cadence signal and controller settings. [#20951631]

PAS vs throttle on a Chinese e-bike controller: which control method is better for comfort, legality, and safety?

PAS is better here for normal riding comfort, while a throttle-like shifter can feel less natural and may raise legal concerns. One reply notes some controllers can use both, but another explicitly calls the fake-pedaling approach a form of fraud and labels the shifter alternative illegal as well. Safety also matters: a poor PAS implementation can start the motor when pedaling backward, while brake inputs can cut drive on some builds. Comfort complaints in the thread focus on delayed PAS restart, not on lack of throttle. [#20951473]

Why does my e-bike motor start when I pedal backwards, and how can I fix reverse-rotation detection?

Your motor starts on backward pedaling because the controller or PAS setup is not distinguishing direction. The author had exactly that problem with an original sensor, so he built a replacement that uses waveform asymmetry and sensor timing to separate forward from reverse. Fix it by using a PAS design with direction detection, or by configuring a controller that supports it. The thread gives one real hazard: a bike can lurch forward at a red light after an involuntary backward pedal movement. [#20951856]

How do KT Sinus controllers and the KT-LCD3 display let you configure PAS magnets and pedal direction detection?

KT Sinus controllers with a KT-LCD3 can configure PAS details such as the number of magnets and the expected square-wave form. The author says these settings are where pedal-direction detection is configured, so a controller that ignores reverse pedaling may simply need correct setup. That makes KT hardware more flexible than fixed no-name controllers. In practice, you adjust the PAS parameters in the display menu to match the sensor ring and the controller’s direction logic. [#20951856]

What output stage should I add if a CMOS or TTL pulse generator does not provide enough current for the load?

Add a separate output stage whenever the logic output current is too small for the load. The thread states the present design ends in a TTL-level output, while the PAS input itself draws only small current because the system behaves like CMOS logic. That is sufficient for a controller signal pin, but not for a heavier load. If you want more current, add an appropriate buffer or driver stage after the generator, not instead of it. [#20951362]

Why does some no-name Aliexpress e-bike controller change support level with pedal cadence, while others only detect that pedaling is happening?

Some controllers calculate assistance from pulse rate, while others use PAS only as an on/off pedaling signal. One poster reports a no-name controller that increases support when pedal cadence rises and even keeps working when pedaling backward. The author answers that such behavior means the controller counts pulses per second and uses that as a guide for support level. His own classic setup does not do this, so controller firmware and configuration create the difference. [#20951856]

How can I design a PAS system with two Hall sensors like TLE4905 to recognize forward pedaling and block output when pedaling backwards?

Use two Hall sensors with a small physical offset and compare which one switches first. The thread’s DIY sensor uses TLE4905-type Hall sensors, spaced by about 5 mm, and logic gates evaluate the phase order. If sensor A leads, the circuit treats rotation as forward and outputs the PAS square wave. If the other sensor leads, it assumes reverse pedaling and blocks the output. The Hall parts already include a Schmitt-type output stage, so they deliver clean rectangles. [#20953244]

What’s the best way to add a delayed PAS shutdown or brake-triggered cutoff so the motor response feels smoother and safer?

The best thread-backed approach is to combine reverse detection or brake input with logic that briefly extends assist after pedaling stops. One participant proposed immediate disable on backward movement and a short hold time of a few seconds after cadence ends, because his bike restarts only after about two full crank turns. He also points to brake-lever sensors that cut drive on a LOW brake signal. That combination targets both smoother response and safer unwanted-start prevention. [#20953180]

How is it possible to make a PAS signal generator without Arduino, using only logic gates and passive components?

It is completely possible because a PAS simulator only needs a low-frequency square wave and simple inversion logic. The author built it from logic gates, resistors, and a capacitor, then measured a working output of 6.4 Hz with 20%/80% duty-cycle choices. No microcontroller was required because the job is deterministic and slow. The thread even jokes about it when asked how it works without Arduino: it simply worked out that way. [#20956549]
Generated by the language model.
%}