Close
0%
0%

Hexo

Six "sided" LED Randomizer a.k.a. an electric die

Public Chat
Similar projects worth following
CURRENT STATUS:
- PCB EN ROUTE (ARRIVAL ETA: APR 21)

This project uses a 555 and CD4017 to randomly illuminate one of six LEDs.
Based on the roulette Circuit from http://www.555-timer-circuits.com/roulette.html

Hexo

Hexo, a play on hexa- as in the prefix for "having six", is a circuit that uses a 555 and CD4017 to randomly illuminate select one of six LEDs, similar to a die. By using a capacitor and transistor, the circuit will toggle through the six LEDs, flashing them in sequence, and then slowly reduce the frequency until only one is left on.

Motivation

Hexo is a project designed to help me understand the steps of circuit design, prototyping, schematic capture, simulation, PCB layout, PCB manufacture, ordering, and assembly. This is my first analog PCB project and was inspired by Contextual Electronics' Getting to Blinky 5.0. I was very excited to have my first project use the 555, a ubiquitous stable of hobby electronics, but I wanted the circuit to do a bit more than blink.


Stages

Circuit DesignFor this project, the circuit design comes by way of 555 Timer Circuits' roulette and dice circuits.
Proto-typing
The final board will use SMD components, but prototyping will be down with a breadboard and THT components.
Schematic CaptureFor schematic capture, I love using KiCAD's EESchema.
SimulationSimulation is done using LTspice and various libraries, notably the CD4000 library from Linear linked within this project. Because I don't own an oscilloscope, simulation helps me to understand the behavior and demands of the circuit.
PCB LayoutPCB Layout is designed using Inkscape for the cuts layer and KiCAD's PCBNew for component and trace arrangement.
Manu-facture
For PCB manufacturing, I'm trying JLPCB for the first time.
OrderingParts ordering is through JLPCB's component warehouse, LCSC.
AssemblyFinally, assembly of the SMD components is done by hand using a Pinecil soldering iron.

hexo_schematic.pdf

Revision 1 schematic

Adobe Portable Document Format - 42.98 kB - 04/11/2021 at 13:40

Preview
Download

hexo.asc

LTspice circuit simulation. YOU MUST INSTALL THE LIBRARIES AND SYMBOLS FROM CD4000.zip

plain - 4.02 kB - 03/28/2021 at 18:39

Download

CD4000.zip

CD40xxx spice model library for LTspice from www.linear.com/software

Zip Archive - 38.80 kB - 03/25/2021 at 01:38

Download

falstad_hexo_simulation.txt

Import this file into https://www.falstad.com/circuit/circuitjs.html to run the simulation

plain - 2.06 kB - 03/28/2021 at 18:30

Download

  • 1 × 7555 Inductors, Chokes, Coils and Magnetics / Pulse, Signal, Datacom, Telecom Transformers
  • 1 × 74HC4017 Electronic Components / Misc. Electronic Components
  • 1 × BC857C Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs
  • 6 × LED Fiber Optics / Emitters
  • 1 × 100nF Ceramic Capacitor Ceramic Capacitor

View all 14 components

  • Parts Received!

    Thomas Countza day ago 0 comments

    I'm still waiting on the PCBs (ETA: April 21), but for now, I tested out some of the LEDs. I hoping the orange really pops against the black solder mask. 0805 is tinier than I thought so I made sure to order a new flux pen!

  • Gerbers Submitted

    Thomas Countz6 days ago 0 comments

    Today, I've touched up the design a bit and sent off the gerbers to PCBWay for review!

    This has been an exhausting amount of work so far, but I've learned A TON already. Without a lot of experience, it's hard to tell whether or not the board will work when it shows up, but I'm excited to find out. I'm thinking that at the very least I'll need to experiment with the resistor and capacitor values to get the LED timing and battery usage right.

    My order from Futurlec still hasn't shipped. I contacted them a week ago and they said they're still working on it... my plan was to have those parts here by now so that I could run experiments on powering this circuit with only 3 volts, but it'll have to wait for the first run of the PCBs—I wouldn't be surprised if they show up first.

    If all else fails, I hope that I end up with some cool PCB pendants and a heck ton of knowledge!

  • Oops.

    Thomas Countz04/04/2021 at 19:45 0 comments

    After finishing the layout, I started doing some electrical checks and the first thing I noticed was that I wired in all of the LEDs backwards.

  • PCB Edge Cut Calculations

    Thomas Countz04/04/2021 at 15:51 0 comments


    I originally intended on using Inkscape to design and export a DXF file to specify the edge cuts on the PCB in KiCAD. However, I had a bit of difficulty understanding how to use Inkscape for precise layout. Instead, because my design was a rather simple geometry made up from a series of triangles, I could calculate the coordinates for each point and use KiCAD's coordinate system directly. The strange thing in PCBNew is that the origin is a random point in the upper left, outside of the border of the design space, but I just used that origin (instead of calculating offsets) and then moved the final polygon into the layout space.

  • Initial Parts Selection and Layout

    Thomas Countz04/03/2021 at 20:36 0 comments

    KiCAD Hype.mp4 from Thomas Countz on Vimeo.

    Time to start building footprints and layout in KiCAD. I came up with a seven sided design that I'll upload in the next log. The intention is for the circuit board to be worn as a pendant.

    I'm still waiting on the THT components to arrive from Futurlec so that I can prototype the capacitor and resistor values. Until then, I don't think I'll be ready to order the SMD parts, but because everything will be 0805s, I should be able to order the PCB sooner, rather than later.

  • Simulations

    Thomas Countz03/28/2021 at 18:38 0 comments

    Falstad

    Run the Falstad simulation here: https://tinyurl.com/yhqfvbpn

    LTspice

    To run the simulation in LTspice, you'll need to download the CD4000.zip file under the project documents and install the model libraries and symbols before downloading and opening hexo.asc

    * /Documents/LTspice/Hexo.asc
    XU1 0 N003 N006 +V NC_01 N003 N003 +V NE555
    V1 +V 0 9
    R1 0 N003 4.7Meg
    C1 N003 0 100n IC=0
    R2 N003 N005 10K
    Q1 N005 N002 +V 0 BC557C
    R3 N002 +V 3.3Meg
    R4 N001 N002 10Meg
    S1 0 N001 N004 0 SW
    V2 N004 0 PULSE(0 1 0.5 0 0 0.1 0 1)
    XU2 0 0 N006 N007 N009 N010 N011 N012 N013 N014 N015 N016 N017 0 VDD 0 CD4017B VDD=3.7 SPEED=1.0 TRIPDT=5e-9
    D1 N007 N008 QTLP690C
    D2 N009 N008 QTLP690C
    D3 N010 N008 QTLP690C
    D4 N011 N008 QTLP690C
    D5 N012 N008 QTLP690C
    D6 N013 N008 QTLP690C
    D7 N014 N008 QTLP690C
    D8 N015 N008 QTLP690C
    D9 N016 N008 QTLP690C
    D10 N017 N008 QTLP690C
    R5 0 N008 4.7Meg
    C3 +V N001 1µ IC=0
    .model D D
    .lib /Library/Application Support/LTspice/lib/cmp/standard.dio
    .model NPN NPN
    .model PNP PNP
    .lib /Library/Application Support/LTspice/lib/cmp/standard.bjt
    .tran 0 15 0
    .model SW SW(Ron=1 Roff=1000G Vt=0.1 Vh=0)
    .include CD4000.lib
    .lib NE555.sub
    .backanno
    .end
    

  • How the 555 Roulette Circuit Works

    Thomas Countz03/28/2021 at 17:54 0 comments

    You can find the PDF version of this schematic under the project's documents.

    When SW1 is closed, C1 quickly charges to VCC (I think there might need to be a current-limiting resistor between C1 and VCC, though maybe SW1 provides this). After C1 is charged, current begins to flow from VCC through both R3 and the Q1's emitter. Because Q1 base voltage is negative w.r.t. the emitter voltage (Q1 base-emitter voltage), the transistor is active forward and current flow through the collector. (It's a PNP).

    Let's continue as if SW1 is still closed. Now that current is flowing through Q1, the 555 begins to oscillate as if it were in astable mode. Charging and discharging C2 to 2/3 and 1/3 VCC respectively and setting pin 3 (output) high and low in kind.

     Pins 2 (trigger) and 6 (threshold) are tied together so that the 555 can continue to "retrigger" itself when C2 is discharged and the voltage reaches 1/3 VCC. In a typical astable configuration, a resistor is placed between pin 7 (discharge) and tied-together pins 6 (threshold) and 2 (trigger). This has the effect of adjusting the duty cycle by altering the charging speed of C2. In this circuit, the duty cycle is manipulated by altering the charging speed of C2 by way of a steadily reducing current through Q1 instead.

    (Note: I believe there should be a decoupling capacitor at pin 5 (control voltage)).

    Now that the 555 is oscillating, pin 3 (output) sends a square wave clock pulse to the 4017 pin 14 (clock). The 4017 is a decade timer and at each rising edge of the clock pulse it will consecutively set each of it's 10 output pins high. Only one pin is high at a time, the other are low. In the case of this circuit, we're only interested in using 6 of the 10  outputs, so we tie pin 5 (Q6), the seventh pin to be set high, to reset which will cause the 4017 to set it's first output (Q0) high instead.

    All of these outputs are used to drive LEDs which whose cathodes are connected to a common current limiting resistor before being tied to ground. These LEDs will continue to be turned on and off consecutively as long as a clock pulse continues to drive pin 14 (clock).

    Let's continue now as if SW1 is opened after being closed. Once SW1 is open, C1 begins to discharge and current continues to flow through VCC and GND by way of Q1. As C1 discharges, however, Q1 base-emitter voltage begins to climb, i.e. the base voltage starts to become less negative w.r.t. the emitter voltage. As this is happening, less current is flowing through Q1 and C2 is taking longer and longer to charge and therefore the clock pulses from pin 3 (output) of the 555 are beginning to slow (the time between clock pulses is increasing). This has the effect of diminishing the speed at which the 4017 is cycling through the LEDs.

    Eventually, Q1's base-emitter voltage reaches the cutoff threshold (~-0.6v) and current stops flowing through Q1. C1 continues to discharge, however, through R3. At this point, whichever LED the 4017 had set to high last, remains lit.

    I'll include a simulation in the next update so that you can see all of this in action with either LTspice or Falstad.


  • First BOM Order & Initial Spice Netlist

    Thomas Countz03/26/2021 at 00:16 0 comments

    Ordering

    I recently placed an order for DIP CD4017s from Futurlec, to build a prototype with on a breadboard. I want to build a prototype so that I can tweak the timing based on the resistors and capacitors; in that effort, I've ordered a few trimpots to help make quick and fine adjustments. I've heard their shipping speeds are very slow (at $4USD postage, I'm not looking to complain). Check out their value packs: 300 5% 1/4W sorted resistors for $2.95USD, 50 Assorted linear IC's for $5.95USD to name a few standouts!

    Dear Thomas,
    Many thanks for your order as shown below,
    
    Qty ItemNumber Unit Price Total Price
    ----------------------------------------------------------
    1 RES14WPACK 1/4W Resistor Value Pack 2.95 2.95
    1 ELEPACK Electrolytic Capacitor Value Pack 3.95 3.95
    3 CD4017 CD4017 Decade Counter/Divider 0.30 0.9
    3 LMC555CN LM555CN - CMOS 555 Timer 0.45 1.35
    3 BUZZERMODULE Active Buzzer Module 0.90 2.7
    1 R010M14W 10Mohm 1/4W 5% Carbon Film Resistor 0.10 0.1
    1 R0047M14W 4.7Mohm 1/4W 5% Carbon Film Resistor 0.10 0.1
    1 R0033M14W 3.3Mohm 1/4W 5% Carbon Film Resistor 0.10 0.1
    1 R010K14W 10kohm 1/4W 5% Carbon Film Resistor 0.10 0.1
    3 C001U50E 1uF 50V Radial Electrolytic Capacitor 0.05 0.15
    1 CERPACK Ceramic Capacitor Value Pack 2.95 2.95
    2 TRIM2M 2M 1/2W Min. Horizontal Pot 0.15 0.3
    2 TRIM50K 50K 1/2W Min. Horizontal Pot 0.15 0.3
    1 TRAPACK Transistor Value Pack 4.95 4.95
    1 DIOPACK Diode Value Pack 2.95 2.95
    ----------------------------------------------------------
    Sub-Total 23.85
    Postage 4.00
    Total 27.85

    Analysis

    While I'm waiting on the shipment, I've been using LTspice to simulate the circuit and get a better understanding of the behavior. I'll post my explanation and analysis in the next update. Over all, LTspice has been difficult to learn but fascinating to see how the components behavior under varying circumstances. I don't own an oscilloscope, so there is no other way for me to see these interactions in such detail. I'll be using the LTspice simulation to explain the circuit in the next update.

    Above, you can see the voltage potential at every other LED anode connected to the CD4017. This produces a cascading effect in sequence with the slowing clock pulses from the 555. In this simulation ten LEDs are used (one for each output of the 4017), but only six will be used in the final design.

    This is my first analog circuit, so it's been fascinating to see behaviors and characteristics jump off of the datasheet and onto the (virtual) bench!


    Here's the netlist for those who want to follow along. Note: you'll need to add the library and symbols from CD4000.zip linked on the project page and update the .lib directives to point to the correct libraries.

    * /Documents/LTspice/555_roulette.asc
    XU1 0 N003 N006 VCC NC_01 N003 N003 VCC NE555
    V1 VCC 0 3.7
    R1 0 N003 4.7Meg
    C1 N003 0 100n IC=0
    R2 N003 N005 10K
    Q1 N005 N002 VCC 0 BC557B
    R3 N002 VCC 3.3Meg
    R4 N001 N002 10Meg
    S1 0 N001 N004 0 SW
    V2 N004 0 PULSE(0 1 0.1 0 0 0.1 0 1)
    C2 VCC N001 1µ
    XU2 0 0 N006 N007 N009 N010 N011 N012 N013 N014 N015 N016 N017 0 VDD 0 CD4017B VDD=3.7 SPEED=1.0 TRIPDT=5e-9
    D1 N007 N008 QTLP690C
    D2 N009 N008 QTLP690C
    D3 N010 N008 QTLP690C
    D4 N011 N008 QTLP690C
    D5 N012 N008 QTLP690C
    D6 N013 N008 QTLP690C
    D7 N014 N008 QTLP690C
    D8 N015 N008 QTLP690C
    D9 N016 N008 QTLP690C
    D10 N017 N008 QTLP690C
    R5 0 N008 4.7Meg
    .model D D
    .lib /Library/Application Support/LTspice/lib/cmp/standard.dio
    .model NPN NPN
    .model PNP PNP
    .lib /Library/Application Support/LTspice/lib/cmp/standard.bjt
    .tran 0 15 0
    .model SW SW(Ron=1 Roff=1000G Vt=0.1 Vh=0)
    .include CD4000.lib
    .lib NE555.sub
    .backanno
    .end
    

     I'm hoping that the simulation gives me enough confidence to build the PCB. I plan on using 0805 SMD resistors and capacitors, so regardless of the values, the PCB layout should remain the same. If I can get the PCB ordered sooner rather than later, that should help eliminate multiple wait times.

View all 8 project logs

Enjoy this project?

Share

Discussions

Ken Yap wrote 6 days ago point

If that's your real name in your profile, it's evidence of nominative determinism. 😉 Nice project BTW. 👍 Back in the day a dice project of mine filled a cigar box and was mains powered.

  Are you sure? yes | no

Thomas Countz wrote 6 days ago point

Thanks! I always knew my last name would Countz for something. 😉 What an awesome ride the world of electronics has gone on. Next thing we know, someone will be working on an electronic die that's embedded in a contact lens and powered by saline. 😆

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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