Вы находитесь на странице: 1из 25

Bike From Hell Documentation

Release 1

Andreas Steiner, Matthias Roggo

September 23, 2014


Contents

1 Information on Hardware-Parts 3
1.1 Bill of Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Details from Datasheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 About Speed 7
2.1 Loading Data into LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 On Bluetooth Hardware and Communitation 9


3.1 CSR BC417 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Bluetooth Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4 User Interface 13
4.1 Processing Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5 Prototypes 15
5.1 Version 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.2 Version 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3 Version 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6 Energy/Power Considerations 17
6.1 Batteries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7 Various Notes & Remarks 19


7.1 The Other Guys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.2 Dimension Circuit Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.3 Why Not Sell it? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

8 TODO 21

i
ii
Bike From Hell Documentation, Release 1

This document describes various aspects of the project, such as information on required hardware, implementation
details, design guidelines etc...

Contents 1
Bike From Hell Documentation, Release 1

2 Contents
CHAPTER 1

Information on Hardware-Parts

1.1 Bill of Materials

1.1.1 Prototype v1

part number value footprint


LED 5 blue 3528
LED 5 green 3528
LED 5 red 0805
capacitor 4 500nF pth-small
resistors 1 ??? 0204
resistors 1 ??? 0204
potentiometer 1 ??? 3165
potentiometer 1 ??? 3165
Todo
update values/footprints for prototype v1 board

1.1.2 Prototype v2

part number value footprint


Multi-LED 5 RGB P-LCC-6
capacitor 3 ? A/3216-18W
resistor 1 2.2k 0204/7
resistor 1 5.6k 0204/7
resistor 1 22k 0204/7
trimm resistor 1 10k RTRIM3165W
trimm resistor 1 50k RTRIM3165W
trimm resistor 1 100k RTRIM3165W
CAT4016 3 ? SOIC24W

3
Bike From Hell Documentation, Release 1

1.1.3 Costs

Merchant Part Qty Cost


Goodluckbuy Bluetooth 3 20.-
Reichelt Multi-LEDs 50 68.-
Bastli CATs 5 12.-
Bastli PCB-prod 2 10.-

1.2 Details from Datasheets

1.2.1 TLC5940

download datasheet
TCL5940 at farnell
16 channels
12 bit PWM control
serial data interface (30 MHz data transfer rate)
drives up to 60 mA (with VCC<3.5 V) up to 120 mA (3.5<VCC<5 V)
error detection : open LED, thermal
reference current : IREF fixed to 1.24 V; multiplied with 31.5
voltage drop 0.5 V for 40 mA output current
linear dot correction (6bit for each channel)
serial interface
reads data on raising SCLK
MSB first, OUT15 first 192 bits for output registers (GS mode for grayscale)
XLAT high pulse latches data to output registers
VPRG=1 to set dot correction values (DC mode) 96 bits
after XLAT pulse, internal SR is set with status information (LOD data, TEF data, DC values) can be
read out via sout
GSCLK must be clocked externally; BLANK must be pulled high every 4096 cycles to reset internal PWM
counter else all outputs turn off

1.2.2 CAT4016

download datasheet
a 16 channel constant current LED driver. The current sunk into each of the 16 pins can be set by an external resistor.
The individual channels are then read in via a SPI compatible interface and can then be latched from the internal shift
register to the output.
some characteristics
serial interface up to 25 MHz
current 2-100 mA

4 Chapter 1. Information on Hardware-Parts


Bike From Hell Documentation, Release 1

supply current <10 mA


the current on each pin is equal to 50x the current drawn from pin RSET see Calculating CAT4016 Current

1.2.3 Other Microcontrollers From Atmel

AT32UC3B064
16k SRAM
10 sfr
ATXMEGA192A3U
16k SRAM
13 sfr

1.2.4 ATMEGA328P

download datasheet
you might also want to have a look at the arduino duemilanove schematics
CPU :
16Mhz (up to 20Mhz); most instructions single cycle
8bit data bus
32 general purpose working registers
accessing memory :
program memory (10k+ cycles)
boot-loader (highest addresses), application memory
32k
e.g. constants accessed via LPM instruction
data memory
2k
0000-001F : GP registers
0020-005F : i/o registers (IN, OUT instructions)
0060-00FF : extended i/o registers (ST/STS/STD, LD/LDS/LDT instructions)
0100-08FF : internal SRAM
direct addressing : entire space
indirect addressing : Y/Z-reg + 63 bytes
accessed in two cycles
EEPROM (100k+ cycles) - 1k
interrupts :
every interrupt must be enabled in status register
interrupt vector : 0000-0067 (26x 4 bytes)

1.2. Details from Datasheets 5


Bike From Hell Documentation, Release 1

the lower the addresse the higher the priority (RESET, INT0, INT1, ...)
26 vectors, each 2 words (4 bytes)
global flag cleared when interrupt executed; set on RETI
on hardware interrupt corresponding interrupt disabled
interrupts remembered (flags set) when global/specific disabled; executed upon re-enabling of interrupts (in
order of priority)
2nd type of interrupts upon condition; will not be executed if condition disappeared before flags re-enabled
always >=1 instruction between two interrupts
SR must be (re-) stored in ISR
timing : 4+3 instructions before ISR execution, 4 instructions on return
SPI
maximum speed : f_osc/4 in slave mode and f_osc/2 in master mode (when SPI2X double speed bit is
set logic one)

1.2.5 LEDs

LRTB G6TG (OSRAM)


ASMT-YTC2 (avago)
120 degree viewing angle
max DC current 50 mA (peak 100 mA), recommended 20 mA
OVSRRGBCC3 (OPTEK)

1.2.6 Hall sensors

TLE49X5 (Siemens)
with schmitt triggers
open collector output
TLE4905 switches between 0 // 10 mT
TLE4935 switches between -10 // +10 mT

6 Chapter 1. Information on Hardware-Parts


CHAPTER 2

About Speed

2.1 Loading Data into LEDs

It is crucial that data is loaded into the CAT4016 shift register fast enough to realize the desired pictures. Especially, if
PWM is to work properly, the shift registers must be loaded fast enough that every pixel actually achieves the desired
PWM resolution.
The following examples were calculated by a python script
16 RGB LEDs with 4bit PWM need a shift-register update-rate of 0.78 MHz at 30km/h

2.1.1 arduino-bit-banging

bit-banging the values manually to the digital I/O port using the library function digitalWrite
for (int i=0; i<16; i++) {
digitalWrite(CLK1,LOW);
digitalWrite(CLK2,LOW);
tinynap();

// Faint LEDs
if ( reg[0][i] ) {
digitalWrite(SIN2,HIGH);
}
else {
digitalWrite(SIN2,LOW);
}

// Bright LEDs
if ( reg[1][i] ) {
digitalWrite(SIN1,HIGH);
}
else {
digitalWrite(SIN1,LOW);
}

digitalWrite(CLK1,HIGH); digitalWrite(CLK2,HIGH);
tinynap();
}

even before considering the generated assembler code, it becomes obvious pretty fast that this is not a particu-
larly efficient implementation; lets first have a look at the implementation of digitalWrite which can be found in

7
Bike From Hell Documentation, Release 1

$CORE/wiring_digital.c
void digitalWrite(uint8_t pin, uint8_t val)
{
uint8_t timer = digitalPinToTimer(pin);
uint8_t bit = digitalPinToBitMask(pin);
uint8_t port = digitalPinToPort(pin);
volatile uint8_t* out;

if (port == NOT_A_PIN) return;

// If the pin that support PWM output, we need to turn it off


// before doing a digital write.
if (timer != NOT_ON_TIMER) turnOffPWM(timer);

out = portOutputRegister(port);

uint8_t oldSREG = SREG;


cli();

if (val == LOW) {
* out &= ~bit;
} else {
* out | = bit;
}

SREG = oldSREG;
}

all these tests are obviously not necessary if you know what youre doing; the above code translates to 55 assembler
instructions that are executed every time the output pin is set/cleared...

2.1.2 iterating through const int[][][]

before every write the array is translated in a nested for-loop


for (int i=0; i<15; i++){
reg[0][ pin_set[0][i/3][i%3]-1 ] = LED_val[4-i/3][i%3] % 2;
reg[1][ pin_set[1][i/3][i%3]-1 ] = LED_val[4-i/3][i%3] / 2;
}

only the implementation of the loop translates to 83 instructions; moreover, the i/3 and i%3 cannot be calculated
directly by the AVR, but are implemented by the compiler that performs a quite tedious nested algorithm each time...

8 Chapter 2. About Speed


CHAPTER 3

On Bluetooth Hardware and Communitation

3.1 CSR BC417


download "datasheet"
where to buy
Deal Extreme $ 6.60
Goodluck Buy $ 6.77
the pinout of the board as advertised on Goodluck Buy

9
Bike From Hell Documentation, Release 1

PIN function
1 TX
2 RX
12 3.3V
13 GND
21 GND
22 GND
24 LED
34 programming
some blogs about it
endasmedia - German - different firmwares with different AT command sets - two different hardware
versions - CSR BlueSuite on CD (with BlueFlash for new firmware)
Byrons Blog - PIN-out
PIN1 (upper left) : tx
PIN2 : rx
PIN12 : 3.3V
PIN13 : gnd
PIN24 : LED working mode indicator (flashing before pairing then continuously high)

10 Chapter 3. On Bluetooth Hardware and Communitation


Bike From Hell Documentation, Release 1

PIN26 : key (?)


AT commands : with CR/LF, must be sent at once, wait one sec between; can be sent when device
is not paired; pin 34 must be pulled high for this (having pin 34 low or floating sets device into
data transmit mode)

* AT+VERSION to get software version


* AT+BAUDx set baud rate (1 >> 1200, 2 >> 2400, 3 >> 4800, 4 >> 9600 (Default), 5 >> 19200 6
>> 38400, 7 >> 57600, 8 >> 115200, 9 >> 230400)

* AT+NAMExxx sets name of module


* AT+PINxxxx sets pairing password (default 1234)
* AT+PN sets parity
HC06 firmware (a.k.a. Linvor1.5) - change baud settings 1200-1382400 - change name (20 char-
acters) - set PIN (1234 by default)
Zonemikels Blog
A Russian blog
ues BlueFlash and parallel connector to program device (parallel pins : 18-25 gnd, 2 CSB, 8 MOSI, 9
clk, 10 MISO, 3.3 V provided by separate voltage regulator and CLK/MOSI/CSB converted 5->3.3V)
Pials (We)Blog
bt specs v2.0+ EDR, 2.4 GHz ISM band, GFSK modulation
<4dBm emission power (class II), sensitivity <=-84dBm
bluetooth serial port profile, authentication, encryption
power supply 3.3V, 50 mA
without pullup on RXD (as recommended by datasheet)
voltage divider CMOS to TTL for RXD
has its own 3.3V LDO voltage regulator (SIP21106DR)
connects PIN34 with jumper
connects LEDs to PIN31 and PIN32
10k/0.1u reset RC to ensure reset on powerup
some more data for datasheet
power comsumption 30-40 mA during pairing, 8 mA afterwards
pads 1x1 mm, 1.5 mm spaced
says TTL/CMOS level input/output
factory default for serial communcation : 9600N81
commands sent without line terminator; should be paused by 1s

3.2 Bluetooth Communication

links
Android + Processing + Bluetooth (oscar)

3.2. Bluetooth Communication 11


Bike From Hell Documentation, Release 1

Amarino
BlueCove

12 Chapter 3. On Bluetooth Hardware and Communitation


CHAPTER 4

User Interface

4.1 Processing Sketch

13
Bike From Hell Documentation, Release 1

14 Chapter 4. User Interface


CHAPTER 5

Prototypes

5.1 Version 1

a single CAT4016
5 RGB LEDs

5.2 Version 2

three CAT4016 to achieve different intensities


5 RGB LEDs

5.3 Version 3

two TLC5940
10 RGB LEDs

15
Bike From Hell Documentation, Release 1

16 Chapter 5. Prototypes
CHAPTER 6

Energy/Power Considerations

6.1 Batteries

triple A batteries
up to 1200 mAh (Alkaline LR03, Lithium FR03)
relatively small discharge current

17
Bike From Hell Documentation, Release 1

18 Chapter 6. Energy/Power Considerations


CHAPTER 7

Various Notes & Remarks

7.1 The Other Guys

7.1.1 Adafruit SpokePOV

some data from their product website (v1.1)


60 LEDs, double-sided
$37.50 for the kit (additional $7.50 for the dongle and $2.50 for the magnet)
4k memory, can save four custom images

7.1.2 RGBike POV (Instructables)

see RGBike POV


uses TLC5940

7.1.3 Monkey Electric

(discontinued) m133s
the professional m464q system : very expensive, displays video and has wireless channel; available Mai 2012

7.2 Dimension Circuit Parameters

7.2.1 Calculating CAT4016 Current

The current for the different CAT4016 should be dimensioned in a way that guarantees that every chip sinks a current
that is significantly bigger than the current sunk by the next smaller chip. Unfortunately it does not make sense to
add the individual currents because our eye perceives luminosity logarithmically (and the intensity is linearly depend
on the current).
The following plot shows some possible values where each CAT4016 can be fine-tuned with a potentiometer to man-
ually set a precise current that fulfills the above-mentioned criteria.

19
Bike From Hell Documentation, Release 1

7.3 Why Not Sell it?

imagine Lilys would spell L-I-L-Y-S when the bike messenger drives through Langstrasse by night

20 Chapter 7. Various Notes & Remarks


CHAPTER 8

TODO

Todo
update values/footprints for prototype v1 board

(The original entry is located in /var/build/user_builds/bikefromhell/checkouts/latest/documentation/parts.rst, line 33.)

21

Вам также может понравиться