Week topic
Last week I created wood for fire. This week I am going to do better.
This week I ran my first halve marathon. And I am printing an Elsa cookie cutter for my daughter. This weeks music tips come from Deborah:
- https://wfmu.org/playlists/EH
- https://www.nts.live/infinite-mixtapes
- https://www.youtube.com/watch?v=KsYxjbYzPsI&list=FLPxqvVOChjUg68MbiCtlHBw
Local notes
Embedded programming.
We program a board.
Henk shows last year presentation. Most things are the same. You can check Tessels documentation for an extensive overview.
What we made is simply an microcontroller connected to an LED. Today we program the microcontroller to alter the current on the pin to the LED so the LED switches on and off.
This can be achieved with a digital and an analogue signal.
Digital is 0 or 1 Analogue can be 0 to 255
A computer has an OS. A microcontroller does not have an OS. You program it with a little program and this program will be repeated over and over. A microcontroller is far more bug free; instructions are simpler and if the cycle can be repeated once, it can be repeated for ever.
A Program The program is made up of a SETUP and a LOOP.
In the SETUP you tell which part of the microcontroller you want to use for what. ie. we are going to use leg/port 7 to push a signal over. This is called OUTPUT mode.
In the LOOP you describe what it is that should happen over that port. ie. make the LED go on, wait a little, make the LED go off, wait a little. And loop this.
This is basically the only function of the Hello Echo Board.
To program we use ARDUINO. This is a modified langauge of C++.
NOTE: when programming: CapitaLizaTion matters!
The microcontroller has a bootloader. The Bootloader tells the board what it is and where it is.
Arduino IDE We start with the Arduino IDE. This is a simple start. Neil doesn't like it because of the overhead of libraries. But for us this makes live more bareable.
There are two buttons in the interface; one to check your code, and one to check, compile and upload.
About the ATtiny214
pinouts The first pin is the VCC The last pin is the GND
Some pins can do more then others, such as ADC. You can find this in the datasheet.
An important pin is the reset pin. and there are two pins you can use to connect to an oscillator.
To make things easier there is a separate Arduino pin numbering for most of the pins. You can find these using Google.
AnalogRead pins: all the pins with PWM
INPUT PIN - The IC can read the signal (voltage) on the pin - this can be analogue or digital
Fot this to work you need a separate part of program; the Switch Digitalread program.
Digital vs Analogue
This can be achieved with a digital and an analogue signal.
Digital is 0V or 5V Analogue can be -120V to 120V
You can set analogue signal by using incremental digital steps; LED's can only be on our off. So a brighter LED is just simply more on.
Protocols There is a wealth of different protocols you can use to talk to your board I2C, UART etc. etc. Today we mainly use serial.
Potentio meter Een regelbare weerstand; met een schroevendraaier ofzo kan je de weerstand direct manueel aanpassen tussen 0 en 255. Deze verbind Henk aan een analoge poort, want hij wil stapsgewijs de weerstand aan kunnen passen.
We connect all these to analogue pins. Otherwise there is no modulation possible.
Changing the resistance in the potentio meter outputs a signal to the MC. The MC modulates this signal to the LED and changes the frequency of the LED; this causes the LED to dim.
This causes an input. This input is now created by the potentiometer. But can also be be made with almost any other sensor. Sensors are probably all potentiomteres of some sorts...
NOTE a lovely serial program is a nice way to visualize the serial signal.
OUr homework:
We need to combine the two programs:
- Make the LED shine
- Make the LED react to the button
Extended assignment; make the LED react to the phototransister.
To learn all the different parts, the Arduino website is great.
Global notes
Inspirations from around the world
Nice table set: http://fabacademy.org/2021/labs/sedi/students/hector-flores/week07.html Lixie lights: https://hackaday.io/project/18633-lixie-an-led-alternative-to-the-nixie-tube Lixie display using attiny85 & neopixel; pot to control which digit --> https://www.youtube.com/watch?v=GOsc-ymUFJg more info here: https://gabriel-as.github.io/EP1001-SP/Part9.html
Lecture
What are the steps to get code into a processor? This is what we are going to learn.
We talk first about architecture. There is Von Neuman but we use Harverd.
There is memory for programs and memory for data. We use RISC
Microprocessors; can do many things, but nothing onitself. microcontrolers can be programmed to do specific stuff as they have memory on board and such
Datasheet WE need to read datasheets. But mostly we need to undesratnd what to read.
There are different kinds of memeory and you need to know which one to use for what.
peripherals are subsystems in the processor and can do various stuff.
word size: how many bits can be processed in every cycle?
Smaller bit controllers can do many small things superfast. And they are cheaper.
Extensa has integrated Wifi
in-system development