Comparator boards
An MQ-2, a flame sensor and a TCRT5000, each lighting a lamp from DO with no board. The same LM393 under three sensors, and DO goes low. There is no microcontroller in it: the simulator solves the 9 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
BeginnerRuns in your browser. Free, and no account needed.
How it works
There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.
// Three comparator boards and three lamps. No board.
//
// Each sensor module is the same LM393 board under a different sensor. DO is
// an open collector: it pulls LOW when the sensor sees something, and it can
// sink a lamp's few milliamps on its own. So each lamp runs from 5 V through
// 330 ohm into a DO pin.
//
// MQ-2 DO low when AO rises past the trimmer: gas, and the warm-up
// flame DO low when a flame is close enough
// TCRT5000 DO low over white, high over the black line
//
// Things to try: watch the MQ-2's lamp go out as it warms up; drag the flame
// in; click the TCRT5000's swatch to swap white for black.
Parts list
11 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Full-size breadboard
- 1 × Power, 5 V
- 1 × Gas sensor, MQ-2
- 1 × Flame sensor
- 1 × Line sensor, TCRT5000
- 1 × LED, red
- 3 × Resistor, 330 Ω
- 1 × LED, yellow
- 1 × LED, green
How it is wired
8 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- 5 V: Gas sensor, MQ-2 pin VCC; Flame sensor pin VCC; Line sensor, TCRT5000 pin VCC; Resistor, 330 Ω (1) pin 2; Resistor, 330 Ω (2) pin 2; Resistor, 330 Ω (3) pin 2
- Ground: Gas sensor, MQ-2 pin GND; Flame sensor pin GND; Line sensor, TCRT5000 pin GND
- Gas sensor, MQ-2 pin DO; LED, red pin C
- Flame sensor pin DO; LED, yellow pin C
- Line sensor, TCRT5000 pin DO; LED, green pin C
- LED, red pin A; Resistor, 330 Ω (1) pin 1
- LED, yellow pin A; Resistor, 330 Ω (2) pin 1
- LED, green pin A; Resistor, 330 Ω (3) pin 1
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.