Learn about RC networks, charge pumps and more while playing the worst game ever on a 'scope!

Similar projects worth following
Serendipity strikes again !!!

Sat. 2016-10-22 : playing with buttons, capacitors and resistors, tied to a scope, I explain the RC network principles to kids at a workshop. And then we start to play with the trace...
The circuit needs a redesign, which I'll explain here !

Many thanks to the kids and LOREM and CercleJ who took part in these afternoon hacks ;-)

During a workshop at LOREM, we stumbled upon a pseudo-analog version of the infamous Flappy Bird using a few parts. Or something like a 1D version of the Tron motorbike race :-D

Nothing fancy, no automatic obstacle detection (you have to do it yourself :-P) and the user interface is... minimalistic at best.

For more electronic workshops ideas, look at #Electronics Workshops Resources

Take your favorite 2-traces DSO, set the speed at a reasonably low level (1s/cm) and tie a potentiometer to channel 2. Set the input range from 0V to Vbattery to fill the screen. You can already "draw" on the screen with this :-)

We were working with 1µF and 1MOhms so the time constant (or slope) is about 1s.

We were not intending to play, just look at the behaviour of another circuit (to be logged soon). One button press discharges the capacitor, another press charges it. Shake, stir and let the rest unfold !

How can we make a better Flappy game ?

Let's start with the fall. I admit that a capacitor's discharge curve is a lousy approximation for a parabola but we'll accept it.

So we have the "altitude" capacitor, here C1=1µF, with a "gravity" pull-down resistor (R1=1M) to discharge it. The 'scope is connected there as well and contributes to its discharge (through RSCOPE) so the probe must be set to 10× (giving an approximate resistance to ground of 900K). The gravity could be tuned with a potentiometer in series with R1.

This can only discharge the capacitor, emulating a non-newtonian world. How is it possible to climb ?

One simple solution is to use a push-button to enable a pull-up resistor (let's say 100K) but this would not emulate the "gameplay" since the duration of the buttonpress would allow a precise modulation of the "height".

Each keypress should increase the height by only a discrete, fixed amount. This quantum can be stored by another charge-holding capacitor, that gets charged by +Vcc and discharged into C1.

To increase the "height" (voltage) by 1/10 of the range, C2 must be 1/10 the capacity of C1. In this case, we have the convenient value of 100nF. It also works with C1/5=200nF, or two 100nF capacitors in parallel (see what I did ? we talk about parallelled capacitors)

A series resistor limits the inrush current. 100 to 1K Ohms (1/1000th of the gravity resistor) should work. This is optional.

With one simple, cheap circuit, we have covered: charge pumps, sample & hold, RC

time, Capacitor voltage dividers, PWM modulation and many other mundane

details, in a very beginner-friendly circuit ! A few modifications lead to the little introduction to sigma-delta ADCs.


1. FlappyScope Duel !
2. version 2

  • version 2

    Yann Guidon / YGDES11/26/2016 at 04:20 1 comment

    Last time (20161023) the kids wanted to build their own circuit. Well, fair enough : why did I even think I should limit the number of circuits anyway ? I'm only limited by the number of push buttons after all. So we built the following circuit:

    The 200nF charge pump lets the trace go higher faster but reduces the accuracy of the trajectory. It's always a matter of compromises...

    This time, we don't use a potentiometer to simulate the "walls". An external circuit is here to help us create a thick trace: a cold-cathode desk lamp provides a strong oscillation that we can adjust, in thickness and position, with the scope's knobs.

    I had left the probes unconnected near the lamp's mains wire and when I pressed "autoset", the scope picked the high frequency induced signal. That's one way to show the direct effects of interference and EMI measures.

    Now, this parasite could be harnessed, by placing the probe carefully, and the vertical deviation knob moves the "track" up and down.

    If you don't have a CCFL, you can still create a high frequency source with discrete oscillators (for example with a 74HC04) but beware of the nasty habits of DSO, aliasing can make crazy shapes...

    Another drawback of this kind of scope is the response time and granularity of the adjustments, which are not as good as analog where the reaction is immediate and more fun to use for such a game.

    Let's now simulate the gravity : the altitude capacitor and the gravity resistor are wired in parallel then the typical RC (dis)charge curve is displayed on the 'scope (using the button as a push-button to recharge C1).

    With two circuits, it's a bit more fun:

    Now we have to add the "flap": a pulse "upwards", charging the capacitor, but with a limited amount. There must not be a direct connection between the altitude capacitor and the power supply, so the intermediary "flap" capacitor is charged instead, and discharged in the other.

    The thought process is quite interesting, and tells a lot about electricity : it's made charges. Capacitors can hold those charges, which can be translated into current and voltage when they move or stay. We can control the flow and voltages through the values of the capacitors...

    When channel 2 is left dangling, it picks up the CCFL's EMI and we can "play" with the traces again:

  • FlappyScope Duel !

    Yann Guidon / YGDES11/25/2016 at 07:59 0 comments

    Having fun with the kids at another workshop, we realised that the scope's 2nd input was also suited to display another charge pump circuit :-)

    Who said that teaching electronics was boring ?

View all 2 project logs

Enjoy this project?



esot.eric wrote 10/23/2016 at 05:08 point

Very cool! 

Flappy-bird is a great comparison as well. Reminds me of the "racer" game I made to test out whether a fast-paced game could be implemented on a slow-refreshing display. Was trying to think of other such things, this is a great idea! hmmm...

(if you're curious:, scroll down a bit to "racer")

How much time do you have in these sessions? Maybe a second-day... Throw-together a (comparatively) high-frequency oscillator on channel 2, to make a course to stay within... Day three, a couple diode-resistor-capacitor "DACs" tied to inputs on a couple comparators whose outputs cause the oscillator to flat-line when hit... No need to go all-out like that, it might be too much.

Great job making an Interesting Demo of these parts/concepts!

  Are you sure? yes | no

Yann Guidon / YGDES wrote 10/23/2016 at 05:27 point

Time is between 1 and 3h, depends... Kids need fast-moving ideas, particularly if they are "talented" :-D

The only enhancements I was thinking of were about collition detection, probably with comparators, but MOSFETs are not precise. BJTs are more stable, I think, so that could be an opportunity to introduce them, though the design of a discrete comparator that draws less than 0.1µA is beyond my reach yet, even worse for 11-years old kids...

I'm still trying to figure out how to make a differential amplifier made of MOSFET for the #Yet Another (Discrete) Clock oscillator buffer...

  Are you sure? yes | no

esot.eric wrote 10/23/2016 at 06:23 point

Ah hah! This is discrete-mosfet-man, I forgot who I was talking to :)

  Are you sure? yes | no

Yann Guidon / YGDES wrote 10/23/2016 at 13:27 point

This is more "no-black-box-man", you see, because I do "educative circuits" :-P

Using an integrated circuit is like cheating :-D

And imagine the day you design your own integrated circuit : you won't have another integrated circuit to save you !

  Are you sure? yes | no

esot.eric wrote 10/25/2016 at 10:38 point

I dunno, No-Black-Box-Man... those little black things in the image for your clock look suspiciously like they're trying to hide their boxy nature with a rounded-facade ;)

  Are you sure? yes | no

Yann Guidon / YGDES wrote 10/26/2016 at 01:16 point

At least their transfer function is as basic as they can be :-D

  Are you sure? yes | no

Yann Guidon / YGDES wrote 10/23/2016 at 05:34 point

Oh and your page/link is great :-)

  Are you sure? yes | no

Does this project spark your interest?

Become a member to follow this project and never miss any updates