Programming My HelloEcho Using Arduino

Emma gave us a basic lecture on Arduino.

I installed Arduino 1.0.6 and started with a tutorial which can be found on highlowtech.org.

Working with Arduino, I choosed an ATtiny44 20 MHz board and a USBtinyISP programmer in the tools menu and opened the Blink example. I uploaded the programm and it didn’t work. I had to find the right pin for my connected analog input. In my schematic it is pin 10 which corresponds to analog input pin 3 of the ATtiny44. Then I had to find the right connection of my FabTiny*ISP and my extended hello echo-world board. Advised by Emma, I used the MISO pin to find the right cable connection.

In Arduino, I choosed an ATtiny44 board with an internal 8 MHz clock and burned the bootloader in order to change the board’s clock to 8 MHz. I uploaded the Blink example to my HelloEcho and its Terminal 1 LED blinked. Using the slide switch, I choosed Terminal 2 and the LED of Terminal 2 blinked. The LEDs didn't brightly blink. The 10 kΩ resistor was too big. So, I replaced it with a 499 Ω resistor.

Photos of a blinking test

To be able to fade in and out and have more possibilities programming the board, I wanted to add an addtional green LED to a PWM pin. I cut an empty trace and soldered a 1 kΩ resistor as well as a green LED on it. I connected the LED to the ground using a tiny piece of wire.

Update of additionally built-in components

Coding, I wanted the green and red LEDs to interrelate. The green LED faded in and out—breathing—while the red LEDs just blinked when the green LED was fully on or off.

To experiment, I connected a cable to one of the screw terminal’s inputs. Carefully holding this cable to ATtiny44’s PWM pin 8 (PB2) and setting this pin as an output, I would be able to simulate a kind of an analog (sensor) signal and read it with my analog input pin 3 (PA3). The green LED should interrelate and shine diametrically towards the red LEDs. First I installed a VCP driver for the FTDI cable. Back to Arduino, I choosed the right serial port, wrote a script to test the set up and read the status of the green LED. The serial monitor displayed 0, the green LED was off.

As planned, I set digital output PWM pin 8 to a value of 4 and manually connected it to analog input pin 3 (PA3) with a cable. As expected, the red LED was dimmed but the serial monitor displayed 0. Probably, my code was wrong or I would have to remove my 499 Ω resistor between pin 8 and my slide switch and replace the 499 Ω resistors connected to my red LEDs with 1 kΩ resistors to get a right value. I replaced the resistors and run my final script.

Update of additionally built-in components

Replacing the resistors, I got a value. The LED faded in and out but the analog 10-bit input signal was just a kind of LOW or HIGH (0 or about 1000) and nothing inbetween. I wasn't able to simulate an analog signal. I would have to discuss this problem with someone else.

Reading ATtiny44’s Datasheet

Reading ATtiny44’s datasheet, I got a notion of what it means to create such a microcontroller and what one could do with it understanding all its features. A very interesting feature is the Capacitive Touch Sensing ability of the microcontroller.

Some notes

The ATtiny44A microcontroller can be supplied with a voltage of 1,8 to 5,5V and operates within a temperature range form -40°C to +85°C (up to +125°C according to package); maximum current per pin 40 mA.

It comes with bi-directional I/O ports with internal pull-up resistors.

Port A provides 8 pins (8-bit) and has alternate functions as analog inputs for the ADC. The ADC is a 10-bit signal with a range from 0 to 1023. It covers MOSI and MISO for programming as well as SDA and SCL for communication. Three pins offer PWM (pulse-width modulation) that means they’re able to generate an output signal similar to an analog output. The PWM is an 8-bit signal with a range from 0 to 255.

Port B provides 4 pins (4-bit). It covers RESET (PB3) and CLK (clock). One pin (PB2) offers PWM as well.

There’re two different packages. One looks like a square, the other like a rectangle with a size of approx. 0,5 cm². A circle mark on top indicates VCC.

Using CrossPack, Xcode and the Terminal to Code C

I already installed CrossPack. I downloaded and installed Xcode as well.

I got started with the tutorial resetting the board’s clock to 20 MHz via the Terminal and creating necessary files to start coding. I connected the FTDI cable and opened the serial monitor in Arduino. I choosed 115200 baud and typed “hello”.

I could open and modify the files via Xcode but didn't go deeper. Following the CrossPack tutorial, I created a project called LED. In Xcode, I opened the project file called LED.xcodeproj. At this point, I stopped my weekly assignment. There wasn't enough time to go deeper into C Code.

Please download the files here: AVR