User:Yoana Buzova/mrSTOCK: Difference between revisions
Yoana Buzova (talk | contribs) (Created page with " inspired by a small DC motor(ripped off a scanner) with an optoelectronic sensor and a transparent wheel with black stripes to determine it's speed and direction. Then ----...") |
Yoana Buzova (talk | contribs) |
||
Line 21: | Line 21: | ||
Dave showed how to transform light into sound here: [[File:Lightto_sound.jpg]] [[File:Scheme_01.jpg]] [[File:Scheme_02.jpg]] [[File:Scheme_03.jpg]][[File:Hbridge_bias_amp.jpg]] | Dave showed how to transform light into sound here: [[File:Lightto_sound.jpg]] [[File:Scheme_01.jpg]] [[File:Scheme_02.jpg]] [[File:Scheme_03.jpg]][[File:Hbridge_bias_amp.jpg]] | ||
==D class Amplifier== | |||
in order to understand how H bridge works -----> | |||
[[File:Dclassamp.JPG|500px]] [[File:Hbridge_bias_amp.JPG|500px]] | |||
and code..... | |||
/* "Class D Amplifier" | |||
using PWM and H-Bridge to drive a speaker | |||
*/ | |||
#include <avr/io.h> | |||
#define PWM9_ON (_BV(COM1A1) | _BV(WGM10)) | |||
#define PWM10_ON (_BV(COM1B1) | _BV(WGM10)) | |||
#define PWM_OFF _BV(WGM10) | |||
void setup(void) | |||
{ | |||
// configure Timer1 (pins 9 & 10) for Fast 8-bit PWM | |||
TCCR1A = PWM_OFF; | |||
TCCR1B = (_BV(WGM12) | _BV(CS10)); | |||
digitalWrite(9, LOW); | |||
digitalWrite(10, LOW); | |||
pinMode(9, OUTPUT); | |||
pinMode(10, OUTPUT); | |||
} | |||
void set_pwm(int value) | |||
{ | |||
if (value < 0) | |||
{ | |||
if (value > -255) | |||
{ | |||
OCR1BL = -value; | |||
} else { | |||
OCR1BL = 255; | |||
} | |||
TCCR1A = PWM10_ON; | |||
} | |||
else if (value > 0) | |||
{ | |||
if (value < 255) | |||
{ | |||
OCR1AL = value; | |||
} else { | |||
OCR1AL = 255; | |||
} | |||
TCCR1A = PWM9_ON; | |||
} else { | |||
TCCR1A = PWM_OFF; | |||
} | |||
} | |||
void loop(void) | |||
{ | |||
int input = analogRead(0) - 512; | |||
set_pwm(input*16); | |||
} |
Revision as of 19:24, 16 March 2013
inspired by a small DC motor(ripped off a scanner) with an optoelectronic sensor and a transparent wheel with black stripes to determine it's speed and direction.
Then ----> Andre's suggestion to check Derek Holzer's tonewheels .... his research in crossings in history between mathematics, physics, electronics and communications theory which found realization in the industries of motion picture films, music, surveillance technology and finally digital communications.
some names+tags
Lev Theremin, Arseny Avraamov, (russian avant-gardea artitsts) --Boris Yankovsky, Evgeny Scholpo, Nikolai Voinov, Daphne Oram (oramics machine), Delia Derbyshire
optical sound in cinema ---- 'visual music' movement in cinema, Norman McLaren, Oscar Fischinger, Len Lye, Whitney brothers
workshop stuff
Stock showed me and Nan how to make an H bridge to control dc motor direction and speed control with pot
Dave showed how to transform light into sound here:
D class Amplifier
in order to understand how H bridge works ----->
and code.....
/* "Class D Amplifier" using PWM and H-Bridge to drive a speaker */ #include <avr/io.h> #define PWM9_ON (_BV(COM1A1) | _BV(WGM10)) #define PWM10_ON (_BV(COM1B1) | _BV(WGM10)) #define PWM_OFF _BV(WGM10) void setup(void) { // configure Timer1 (pins 9 & 10) for Fast 8-bit PWM TCCR1A = PWM_OFF; TCCR1B = (_BV(WGM12) | _BV(CS10)); digitalWrite(9, LOW); digitalWrite(10, LOW); pinMode(9, OUTPUT); pinMode(10, OUTPUT); } void set_pwm(int value) { if (value < 0) { if (value > -255) { OCR1BL = -value; } else { OCR1BL = 255; } TCCR1A = PWM10_ON; } else if (value > 0) { if (value < 255) { OCR1AL = value; } else { OCR1AL = 255; } TCCR1A = PWM9_ON; } else { TCCR1A = PWM_OFF; } } void loop(void) { int input = analogRead(0) - 512; set_pwm(input*16); }