Hacking CD-ROM Player Part I
The CD-ROM player (or DVD player) is a nice source for electronic parts and hacking. You can also learn a lot by taking a CD-ROM player apart. I do want to warn for the laser. If you have the player open and hook it up to power, make sure you disconnect the cable to the head with the laser. Work on your own risk, I'm not responsible.
Without hacking you can still get some nice parts out of the player, here are some examples:
- DC electric motors. Probably even two of them, one for opening the CD bay/tray, the other for moving the laser head;
- Some small things, like buttons, LED's, cable (and connector). Also jumpers and audio connectors can be found;
- Big electric motor, also BLDC called. It also has a strong magnet on it;
- 40Mhz crystal;
- hall effect sensor.
I have forgotten the laser, but it is dangerous. Damage to the eye cannot be fixed.
Al right, let's hack something. First we begin with something simple. The two DC motors look like fun and don't require much power to turn, you can easily run them directly on an ATtiny13, but I advice to use an extra transistor that gets the beating. The ATtiny13 can serve as a PWM generator.
I have a nice and simple setup to do this:

The big cable junk is just to program the ATtiny13. The long green wire goes from pin 2 (PB3 in code) to the NPN transistor base. The transistor is a BC549C, it can hold max. 500mA. There is a small diode at 25 to prevent things going wrong. The two 10 Ohm resistors is where you connect the plus of the DC motor. You can use this schematic also for a LED or buzzer.
Let's get some code to make simple PWM. I'm using Assembler. There will also be a post/tutorial on programming in Assembler.
.include "tn13def.inc"
.def mp = r16
.def temp = r17
.def t1 = r18
.def t2 = r19
rjmp main ; go to main
delay:
clr t1 ; clear register
clr t2 ; clear register
ldi temp, 10 ; set register temp (r17) to 10
delaywalk:
;dec T2 ; 256 x 3 x 10 = 7680 cycles
;brne delaywalk ; uncomment these for longer delay (+160 ms)
dec T1 ;
brne delaywalk ; standard ATtiny13 clock is 9.6Mhz
dec temp ; 9.6Mhz/8 (divider) = 1.2Mhz a cycle
brne delaywalk ; total delay time = +/- 6 ms (with temp on 10)
ret ; go back to where you came from
main:
ldi mp,0b00001000 ; set 8 bit binary (note 8 numbers)
out DDRB,mp ; set pin 2 or PB3 to 'on'
loop:
LDI mp,0x00 ; set register mp (r16) to value 00
OUT PORTB,mp ; put 00 (low) value to port, means off
rcall delay ; jump to/call delay
LDI mp,0xFF ; set register mp (r16) to value 255
OUT PORTB,mp ; put 255 (high) value to port, means on
rcall delay ; jump to/call delay
rjmp loop ; jump back to loop
To make ON time longer than OFF time, you can simply put 'rcall delay' two times in the code or make a new delay branch.
That's all for part I.





December 27th, 2009 - 18:06
I love this kind of hack ! Looking forward to seeing part 2 ! I keep an eye on your blog !
December 28th, 2009 - 16:56
Thanks. I got some nice idea’s for part 2, which will also be a bigger post, but I need to do some learning/testing before I can make the post.