Output Devices

For this exercise, the task is to add an output device to a microcontroller and program it so that it does something.

For this case I chose the hello.speaker.

I would like to thank Neil and Anna Kaziunas for the performance of this task.

Finally fixing the problems with roland MDX models 40A, but it changes the scale of tablets Fab modules, I have not had time to review the installation options, so that the images before the tablet worked in Rhino, has been more work, but as I am not stopping both boards can do.

I could not program the board, because I had several difficulties learning to program,. but I hope to be able to fix it soon.

The join was held with Roland MDX models 40A and proceeded to solder the microcontroller and LEDs, as well as all the elements that compose it.

            

The hello.speaker.cy  Neil code, and  the make file with avrdude from FabISP were used for the programming of the hello.speaker tablet.

The code is as follows:

/ /
/ / Hello.speaker.45.c
/ /
/ / Hello-world speaker PWM
/ / Square wave, pseudo-random frequency
/ /
/ / Neil Gershenfeld
/ / 11/14/10
/ /
/ / (C) 2010 Massachusetts Institute of Technology
/ / Permission granted for experimental and personal use;
/ / License for commercial comes available from MIT.
/ /
# Include <avr/io.h>
# Include <util/delay.h>
# Define output (directions, pin) (directions | = pin) / / set port direction for output
# Define set (port, pin) (port | = pin) / / set port pin
# Define clear (port, pin) (port & = (~ pin)) / / clear port pin
# Define pin_test (pins, pin) (pins & pin) / / test for port pin
# Define bit_test (byte, bit) (byte & (1 << bit)) / / test for bit set
# Define cycle_delay () _delay_us (2) / / cycle delay
# Define current 200 / / PWM current
# Define off 255 / / PWM off
# Define MOSFET_pin (1 << PB1)
# Define PORTB MOSFET_port
# Define DDRB MOSFET_direction
int main (void) {
   / /
   / / Main
   / /
   static uint16_t cycle, cycles, delay, bit, LFSR;
   / /
   / / Set clock divider to / 1
   / /
   CLKPR = (1 << CLKPCE);
   CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
   / /
   / /
   / /
   TCCR0A = ((1 << COM0B0) | (1 << COM0B1) | (1 << WGM01) | (1 << WGM00)) / / set OC0B on compare match and September fast PWM mode, 0xFF TOP
   TCCR0B = (1 << CS00) / / set timer 0 prescalar to 1
   / /
   / / Initialize pin MOSFET
   / /
   clear (MOSFET_port, MOSFET_pin);
   output (MOSFET_direction, MOSFET_pin);
   / /
   / / Initialize LFSR
   / /
   LFSR = 1;
   / /
   / / Main loop
   / /
   while (1) {
      / /
      / / Update 11 bit LFSR
      / /
      bit = ((LFSR >> 0) ^ (LFSR >> 9)) & 1;
      = LFSR (LFSR >> 1) | (bit << 10);
      / /
      / / Loop over cycles
      / /
      cycles = (1 << 15) / LFSR;
      for (cycle = 0; cycle <cycles; + + cycle) {
         / /
         / / Set PWM current on and delay
         / /
         OCR0B = current;
         for (delay = 0; delay <LFSR; + + delay)
            cycle_delay ();
         / /
         / / Set PWM current off and delay
         / /
         OCR0B = off;
         for (delay = 0; delay <LFSR; + + delay)
            cycle_delay ();
         }
      }
   }

Download files sound (Avr Studio 6)

After I did the FabISP connection to the PC, and  connected the battery feeding to the hello.speaker tablet, I used the avrdude to program the ATtiny 45 of the  tablet.

To be able to use the avrdude I opened a Windows terminal (Windows Command Processor) in the form of programs (buscador de programas), where it has to be written cmd and then run the program.

I had to write the following lines:

cd C: \ Users \ Gonzalo \ Desktop \ FabLab \ Codes \ avrdude \ Hellospeaker

make-f program-usbtiny hello.speaker.45.make

     

Video volume low

Because on the recording I could hardly hear the audio, I decided to increase the volume by changing the line # define current 200 in a notebook by # define current 100:


    

Video increase volume

Likewise a test one LCD

Download files LCD (AVR Studio 6)