hola soy un mensaje secreto wiwiwi wawawa

EMBEDDED PROGRAMMING

Assignment:

  • Read a microcontroller data sheet.
  • Program your board to do something, with as many different programming languages and programming environments as possible.

  • | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    // CONCEPTS AND INFORMATION TO KNOW BEFORE YOU START:


    While I was reading almost all of the ATtiny 44 datasheet, I had to look for a lot of concepts about electronics. This are some of which I think are some of the most important ones:

  • ISP: In System Programming or In Cirucuit Serial Programming. According to Wikipedia it is the ability of a programmable logic device to be programmed while installed in a complete system. For Fab Academy your ISP Board is the first one that you milled during the "Electronics Production" Week.
  • ATTiny44: A microcontroller fabricated by AMTEL. This belongs to the AVR family, which is the same one that Arduino uses for it's boards.
  • Microcontroller: ATtiny is an 8bit microcontroler, a a self-contained system with memory, a processor and peripherals that can be used as an embedded system. According to wikipedia, program memory in the form of Ferroelectric RAM, NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM.
  • I also found nice microcontrollers information here. Programmable microcontrollers contain general purpose input/output pins, and their number can vary. The pins can be configured by software to an input or an output state. When these pins are configured to an input state, they can be used to read sensors or external signals. When they are configured to the output state, these pins can drive external devices such as LED displays and motors.
  • Arduino/Genuino IDE (integrated development environment). This is a software that contains a text editor for writing code, a message area, a text console, a toolbar and a series of menus. It was based on Processing, and if you are not familiarized with the Arduino code, I recommend you to take a look at the tutorials documented over Arduino/Genuino's site and also at the "Arduino Cookbook" by Michael Margolis.

  • To understand about pins of the ATtiny talking "Arduino" I made this diagram.

    images


    | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    // BEFORE STARTING

    -Verify that you have already removed Jumpers ( O Resistors ) from your small ISP board.

    images

    -Verify using a Multimeter that all of your connections are good.

    -Create a 6 connector

    -Understand header's cable connections. I used a multimeter to verify correspondance between female header pins and coloured wires.

    images


    | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    // INSTALLING ATTINY SUPPORT IN ARDUINO


    For my assignment I used Arduino 1.6.8 and I'm using a Mac 10.9.4

    -First of all, install Arduino/Genuino here

    -Download this Arduino's library so your IDE will give you the options for ATtiny microprocessor.

    -Go to your Arduino folder ( must be in ../Documents/Arduino ).

    -Create a new sub-folder called "hardware"

    -Create a new sub-folder named "attiny"

    -Create a new sub-folder "avr". (../Documents/Arduino/hardware/attiny/avr)

    -Paste the unzipped files that you downloaded.

    -Open Arduino

    -Go to "Tools" --> "Board"

    -You should see now a list of Arduino boards, including ATtiny.


    | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    // PROGRAMMING ATTINY 44


    -Connect your ISP board to your ATtinny board using your new FTDI cable.

    -Make sure you VCC goes to VCC, GND to GND and so on. ( Use a multimeter! )

    images

    -Connect your FabISP board to one USB ports on your computer (USB cable), and your Hello board to another (FTDI cable).

    -Open Arduino, and go to "Tools" --> "Board". Select "ATtiny".

    -Set Clock to "20 Mhz.". This is because the Crystal that you soldered is 20 Mhz and it is responsable for the time in the board.

    images

    -Set the programmer to "USBtinyISP"

    images

    -Go to "Tools" --> "Burn Bootlader"

    images

    -No your board is ready to be programmed! Yey!


    | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    // BLINK TEST


    - Open Arduino and go to "Files" --> "Examples" --> "Basics" --> "Blink".

    -HighLow website has a nice diagram useful to know the translation between ATtiny and Arduino pins here.

    images

    -This is an example to be used with an Arduino board, with a led in pin no. 13. You'll need to change it to pin no. 7. (Pin no. 6 in ATtiny)

    images

    -Upload the program to your HelloBoard and if your led starts to blink, then it works!

    images


    | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    This is the code that I used, by Scott Fitzgerald:

    void setup() {

    pinMode(7, OUTPUT);

    }

    void loop() {

    digitalWrite(7, HIGH);

    delay(1000);

    digitalWrite(7, LOW);

    delay(1000);

    }


    | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    --> And a code to turn on your led using the tinny button:

    int button = 3;

    int led= 7;

    int buttonState = 0;

    void setup() {

    pinMode(led, OUTPUT);

    pinMode(button, INPUT);

    digitalWrite(button, HIGH);

    }

    void loop(){

    buttonState = digitalRead(button);

    if (buttonState == HIGH) {

    digitalWrite(led, LOW);

    }

    else {

    digitalWrite(led, HIGH);

    delay(500);

    digitalWrite(led, LOW);

    delay(500);

    digitalWrite(led, HIGH);

    delay(100);

    digitalWrite(led, LOW);

    delay(100);

    digitalWrite(led, HIGH);

    delay(100);

    digitalWrite(led, LOW);

    delay(100);

    digitalWrite(led, HIGH);

    delay(100);

    digitalWrite(led, LOW);

    delay(100);

    digitalWrite(led, HIGH);

    delay(500);

    digitalWrite(led, LOW);

    delay(500);

    }

    }


    | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


    // Questions - What do I want to learn?

  • Wireless communication creating my own modular radio boards. I've checked in the fab inventory and we have some components that look poweful.
  • How to add minimum size energy suply to my boards?
  • What's the difference using 4 bit bi-directional input/outputs pins?
  • I'd love to geet deeper on coding practice.

  • Extra exercise:

    Light sensor + Servo Motor from Citlali Limonada on Vimeo.

    CODE:

    Citlali Hernández - Fab Academy - 2016