# Null Space Labs

### Site Tools

nsl_cylon_ii

Next version of the Cylon

<center>300px<BR>

300px|Cylon II 30 LED version 300px|Cylon II 30 LED version </center>

## Todo

• Shrink size (maybe) shrunk
• Decide on 30 or 20 LEDs (30)
• Finish code and upload to wiki
• Figure out the deal with TV-B-Gone mode

## Charlieplexing

Use this link to load and create a circuit simulator, this needs Java Two LEDs

• Toggle the H and L with the mouse, use the switch to turn on and off the line, this basically simulates 'tristate' ON(H) OFF(L) and Dont care(X), but we only need HIGH and LOW for this first step. You can switch on two LED's by switching the H and L.

<HR>

By changing the H/L inputs and switches to on or off, that you can control each LED separately. Simulating a tristate, on off and not connected, or high impedance.

<HR>

<java_applet

``` code=Circuit
height="550" width="500"
archive="Circuit1.jar"
p1name="pause" p1value=20
p2name="startCircuit" p2value="cp.txt"
p3name="startLabel"  p3value="Charlieplexed"
p4name="useFrame" p4value="false"```

/>

<HR> The number of LED's that can be charlieplexed is determined by the following formula OUPUTS*(OUTPUTS-1). So if you have 3 pins, that is 3*2 = 6. Additionally (OUPUTS-1) LED's switched on at any one time So with 3 pins you can have two LED's on at any one time.

This works because LED's are diodes, so they'll let the current flow one way, but not the other way and that on some uC's you can set high low and dont care (which is typically input). When the pin is input mode, it doesn't affect the circuit since its just reporting what is there. A visualisation of this is in the simulator by way of the current flow.

Wikipedia has a write up too wikipediafile

## Design notes

During the build a few mistakes were made, first simple copy paste errors in schematic and not triple checking the label names, its easy to do and no matter how many times you go over it, it'll likely happen this is where the wire jumpers come into place. Another problem was the metal switch has a clip underneath that just happened to touch the trace to the speaker so shorted it out when pressed (only affects the CNC versions, since there is no mask). This maybe related to the actual switch itself and using the wrong hotplate soldering profile, as the cover came loose. however the trace still needs to move, just in case.

Finally on the 3rd revision I managed to somehow isolate the ground from the battery and eagle didn't pick it up, a quick trim with the knife and it was fixed, again easy to do we added another trace to the already working board, shrunk the dimensions, and sliced the ground plane. Eagle will normally show an airwire, but I've noticed sometimes it doesn't if you don't do a ratsnest command.

Power usage is higher, with 200 ohm resistors and the speaker running constantly with all led's lit, we get about 5 hours runtime, with 470 ohm resistors it looks to be about 8. This is with continuous tone and all led's. with running mode and no speaker so far the the first prototype has been going strong for about two days, its using 280 ohm resistors (we're using different resistor values to alter the brightness of the LEDs). Next power test is to have the LED's do various modes and the speak play music and see how long that lasts. Adding a resistor to the speaker may help too.

Turned out the speaker was on all the time !

Added larger battery holders , CR2450s. Tried 6V with white leds and two CR2032s , tried two CR2025s in CR2450 holder (all variations seem to work) New speaker? 10V for a 1/2 second didn't blow the chip!!

## Virtual Cylon II

We're going to try to offer people a way to make the Cylon II before getting hardware, both hardware and software emulation.

Here are some links for you to try this too, some of these do circuits, some do mcus, so do AVR's, none of them may do the ATTiny2313 but you can add it if they don't.

Some of the ways of doing this are just to write a tool that does the patterns, but doesn't let you do the code. Then we can emulate the CPU and the LEDs, speakers etc. A circuit simulator can do a good job of emulating the charlieplexing and pwm, which will let you look at whats going on in the circuit.

## Code

Available on the NSL SVN

Under “/032/NSL_CylonII/” Make sure the CLKDIV8 fuse is set “off”.