Week 08

Embedded Programming

01

Assignments

  1. Group assignment.
    • Compare the performance and development workflows for different microcontroller families.
    • Document your work (in a group or individually).
  2. Individual assignments
    • Read the datasheet for the microcontroller you are programming.
    • Program the board you have made to do something, with as many different programming languages and programming environments as possible.

Software

Download File

week 08

02

Assignments

Group Assignments (1)

    • Compare the performance and development workflows for different microcontroller families.

    • We have not yet been able to access the FabLab, nor the corresponding equipment to carry out the physical practices, which in my case are very necessary since it is not the same as simulating situations with characteristics given by default.

    • Document your work (in a group or individually).

    • We have not yet been able to access the FabLab, nor the corresponding equipment to carry out the physical practices, which in my case are very necessary since it is not the same as simulating situations with characteristics given by default.

Individual Assignments (2)

    • Read the datasheet for the microcontroller you are programming.

Possibly this is one of the more complicated weeks, since the whole electronics part definitely hadn't been my thing until this couple of weeks. Despite working with 2 pcb and its architecture, I am still in the way of discovering how things work.

I have seen many pcbs with the ATtiny 44 format and for the components that were in our FabLab, I went for the ATtiny 45, which is also very similar to the ATtiny 85.

At this time I still cannot understand very well how things work so I have had to search for additional resources on the web to make my learning curve faster, however there are certain things that I am learning through suggestions to pay attention to it.

Data sheets are instruction manual type specifications for microcontrollers and electronic components. They try to explain what a component does and how to use it. Unfortunately for some of us with technical training and experiences other than electronics and programming languages, this task of reading, understanding and applying what is indicated in these documents is not easy because technicians in this discipline develop it for other technicians in the field. same discipline; in my specific case I am not in this area. Even so, these specification sheets are an important element when proceeding with a project that involves electronics and the proper functioning of a circuit.

  • ATtiny25/V / ATtiny45/V / ATtiny85/V
  • One of the essential things is to know how the pins work and their specific functions within the microcontroller, to design according to our needs.

    For the status record that I read from a friend's page in a previous academy, I found it interesting and for this I refer you to: Status register (Wikipedia)



      • Program the board you have made to do something, with as many different programming languages and programming environments as possible.



    Thinking about my final project, I found this other microcontroller that in essence has many more pin outputs and I think it will help me complete my prototype.

  • megaAVR® Data Sheet




  • While we wait for this quarantine to move to a new way of life, I am either between work and university or that does not give me so much time to continue learning on my own; I can only take advantage of the occasional moment to do something interesting like trying to do work tests. On this occasion I am with a couple of days of testing if I can understand the theory and practice through readings, video tutorials and the occasional help from colleagues passionate about these issues.



    First download Arduino IDE and install it later on the laptop, to start working. At first I found that I had an error in the void setup because I used the upper case "if" function, corrected this, I still had an error this time because I did not put the closure of a bracket that I had not seen and supported by video conference with a new partner, made me see my distraction.



    For this assignment we use some things that are in an Arduino kit to simulate what in theory I should develop and present this week, I used this material that was provided by the instructor a few days ago, trying to advance and understand how it should work in reality, since access to the Fab is restricted by the national quarantine. I also ended up using Arduino IDE to program the action of the components.

    I will do it using Arduino Uno as a platform to simulate the connections of the component with the own pcb due to the lack of access to the FabLab and to be able to manufacture the pcb that I have designed in previous weeks.

    For the video, change the code a little, referring to some references.

    Before I forget, I must tell you that the material posted above will be developed as evidence in week 6, however I will move it to this week, since it is about programming something and being able to verify if it works according to the theory supplied and acquired.



    Working with blocks in TinkerCAD is much more intuitive and somewhat easy due to the flexibility it gives you to play as if they were laymen. In it you work everything at the same time and you only go from one tab to another to view and obtain the respective codes. For this, only the respective components (to be used) must be placed and later join these with the cables or wires and prove that it works through simulation.



    Apparently it also generates the circuit design, however in my case it sends me an error when trying to open the board in Eagle. It would have been fantastic to have it, it would save me a lot of time and steps, with more time I will try to delve into this topic.

  • The above is part of my first steps, now if the serious comes:

  • Before describing the assignment, I will take on the task of studying the ATtiny45, as it is the one we have been told is on the Fab and I also consider it to be very versatile at the moment.

    • It is an 8-pin AVR controller, to develop a program or code with various references.
    • It cost is economic.
    • It offers simple and complex functions.
    • It has a 4 Kb cmemory.
    • It has energy savings.
    • It has a small and compact size.

    A. For the resolution of this week's individual assignment, I have decided to use an ATtiny45 and the following components, since I have been carried away by playing with the Leds:

    • 1 - button.
    • 1 - 10 K Ohms resistor.
    • 1 - red LED.
    • 1 - blue LED.
    • 1 - yellow LED.
    • 1 - green LED.
    • 4 - 220 Ohms resistors.

    B. Make an outline of how the different parts or components should be placed, trying to find the logic of interaction, this part to be taken into account for those of us who are learning.



    C. I proceed to design the pcb in Eagle and generating the schematic and the respective board. In theory it would be to reproduce point B, but in program.

    D. After several very basic exercises such as the one outlined above, I give myself the task of writing the code and for this, a logical sequence must be followed, since not doing it every time we verify what is written will give us an error, which in many cases the error code is different; depending on what we write. For this:

    • We place integer values ​​for the components and their outputs on the corresponding pins.
    • In the setup function we configure the input and output values ​​of the components.
    • In the loop function we read the values ​​of the pins stored in the variables. The most significant thing is that if it takes the value of “1”, the current will be turned on or the LEDs will light up, and if, on the contrary, the value is “0”, the LEDs will be off.
    • The most curious thing is that with the PWM or pulse function you can control the LEDs placed on the corresponding pin outputs and it works as an automatic dimmer with a time lapse in milliseconds.
    • As I write the code, I proceed to verify and compile it, and once finished, proceed to generate the HEX file that is saved in the flash memory of the microcontroller. At this point the pcb has to be connected to the laptop and in the corresponding port. At this point as I mention several times, I will be using an Arduino UNO board.

    E. Since we are still in quarantine, I carry out the simulation using an Arduino UNO and if I find the accumulated fatigue, to show see the video that I share below.

    F. Once we get out of the enclosure, I will proceed to manufacture and solder the PCB.

    Inconveniences - Delays

    • Perhaps because of my experience in electronics and programming, I should have started with something simple (TinkerCAD), although some think that this is for the youngest, instead of getting fully involved with Arduino. The experience was very good, but if I must say that something tragic...
    • We continue with the quarantine by COVID-19
    HTML Comment Box is loading comments...