Index

Introduction

The following project was born with the idea that electronics is very easy to learn and modular at the same time. Although I have already finished my Fab Academy, I am still researching. Speaking with my instructors Nuria and Pablo, I told them that I wanted to continue working on the Hello World project, but I was not satisfied with making a board for each sensor or actuator.

So I decided to make a board with the ATtiny1614, where I could use the maximum pins for the inputs or outputs; that had external power; I2C connection. The idea is that a student can test as many sensors as possible, become familiar with electronics and programming little by little. And the Adrianino was born.

Furthermore, I wanted to go one step further and place a VCC pin next to the UPDI programming pins, which I will explain later on how it works.

Features

  • This board has FTDI and UPDI + VCC connection to program it without the need for external power (or the FTDI).
  • It contains a voltage regulator to power the board with a power supply (9V battery).
  • It has another 9V power connection to for example power a DC motor driver.
  • Then there are 4 outputs or inputs with VCC and GND on each side to be able to connect different inputs or outputs.
  • On the left there is an I2C connection to connect an LCD, OLED or a sensor that uses this communication.
  • There are 3 outputs or inputs at the bottom and with a GND pinout.
  • There is an LED and an integrated button, which will help us to test that the microcontroller works with a simple program.
  • Through the FTDI connection we can read the data from the different sensors through the Serial.

Datasheet

ATtiny1614

As we have looked at the graph, there are more microcontrollers within the tinyAVR-1series family. Another ATtiny I use is the 1614. I combine the Datasheet image with the one from the SpenceKonde website on the ATtiny1614.

  • 14 pin package.
  • Two internal clocks 16 and 20 MHz.
  • 16 KB Flash Memory.
  • 256 B EEPROM.
  • 2 KB SRAM.
  • Maximum voltage: 6V; minimum voltage -0.5 V.

After looking at the basic features, you will find the pinning of the microcontroller.

  • VDD: Supply voltage.
  • GND: Ground.
  • Digital pins: Port A: PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7. Port B: PB0, PB1, PB2, PB3.
  • Analog pins: PA1, PA2, PA3, PA4, PA5, PA6, PA7. Port B: PB0, PB1.
  • UPDI Programming pin: PA0 (physical pin number 10).
  • External Clock Pin: PA3.

All I/O pins can be configured with internal pullup resistance.

Within the communications section there are different types and their pins are different. It is clear that the different communication protocols cannot all be used at the same time, because they have pins in common.

  • USART - Universal Synchronous and Asynchronous Receiver and Transmitter: It has the RX (PB2 or PA2) and the TX (PB3 or PA1).
  • SPI - Serial Peripheral Interface: It has only MOSI (PA1), MISO (PA2), SCK (PA3), SS (PA4) .
  • TWI - Two Wire Interface (I2C): It has SDA (PB1 or PA1) and SCL (PB0 or PA2).

Another important thing that the datasheet is telling us is that you have to keep in mind which kind of input component you are using, digital or analog: for instance, if you are using a temperature sensor (analog component) you have to connect it to an ACD (analog to digital converter) port otherwise the microcontroller isn't able to transform the information that is receiving from the sensor to a digital data.

BOM and Schematic

This is the schematic where you can see all the components.

Adrianino

Where to buy? Amount Price Total price
Proto Board FR1 Digikey 1/4 board 1,24 €/unit 0,31 €
ATtiny1614 Digikey 1 0,64 €/unit 0,64 €
1uF capacitor 50V Digikey 1 0,18 €/unit 0,18 €
4,99kΩ resistor Digikey 2 0,09 €/unit 0,18 €
499 Ω resistor Digikey 1 0,09 €/unit 0,09 €
IC Regulator 5V 1A SOT223 Digikey 1 0,43 €/unit 0,43 €
1kΩ resistor Digikey 1 0,09 €/unit 0,09 €
LED Digikey 1 0,35 €/unit 0,35 €
Button Digikey 1 1,00 €/unit 1,00 €
SMT RT Angle Male Header 0.1" (36pos) Digikey 9 0,15 €/unit 1,35 €
Female 1 row horizontal header Digikey 14 0,15 €/unit 2,10 €
Male 2 row vertical header Digikey 3 0,20 €/unit 0,60 €
Total cost 7,32 €

Board design

Here you can download the Eagle files and the PNG's. Here is a sample of the PNG's, traces and cutting lines.

UPDI + VCC module

At the time of programming, until now I used the Hello USB-serial.FT230X + Hello serial-UPDI.FT230X and also the power supply of the board with an FTDI (which later helps us to read through the Serial).

With this adapter we have the Serial + UPDI + VCC adding a higher pin, without the need to use another FTDI to power the board.

Schematic and board design

The design is the same as the one Neil uses, except that I add the Vcc pin to power the board that we programmed.

Here you will find the PNG's and the Eagle file to download them.

Operation

The connection is very simple, we only need the FTDI-USB and we connect the UPDI + VCC module to the board, in this case to the Adrianino that has the three pins (UPDI + GND + VCC).

Programming

Linux + Arduino + PyUPDI

I follow the tutorial that Pablo taught me that they used in the Bootcamp in India that Santi from Fab Lab BCN created.

  • 1. For this I install Arduino. Within Arduino, in the preferences tab we will add the URL to load the Arduino IDE with other cards or microcontrollers. Spence Konde tutorial

  • 2. I download "pyupdi".
  • 3. Open terminal. Install dependeces: pip3 install intelhex pylint pyserial

  • 4. I connect the USB-FTDI.
  • 5. I run dmesg -w
  • 6. Connect and disconet the ftdi cable and take note of the "port name" where:

  • 7. I configure the Arduino IDE for the ATtiny 1614; I configure the clock to 20MHz, the TX and RX ports and in my case the communication port with the /dev/ttyUSB0 microcontroller.

  • 8. Only the code is compiled. In the Arduino IDE dialog box, we will see where the temporary files are located.

  • 9. We look for the .hex file which is the one we need, it is in a temporary folder. Once located, we copy it and paste it in the pyupdi folder.

  • 10. I connect it as follows. USB-Serial-FT230X + UPDI-VCC.

  • 11. Go into the "pyupdi" folder.
  • 12. Program the board using python -> run sudo python3 pyupdi.py -d tiny1614 -c /dev/ttyUSB0 -b 115200 -f Blink.ino.hex -v

In this short video you can see the process of loading the programming and the operation of a Blink on pin PA1 (8 in Arduino) where the LED is integrated. 😍

Inputs

Button

The button is the simplest element of the inputs. It is an open or closed contact that when we press it changes its state to closed or open.

  • Connection and schematic
  • In this case, the button is integrated on the board, on the PA3 pin (Arduino pin 10) and the LED on the PA1 pin (Arduino pin 8).

  • Programming
  • Here you will find the programming to use the button. Here you can find the Arduinio file to download.

    - Arduino Hello Button

    //Fab Academy 2020 - Fab Lab León
    //Button + LED                           
    //Adrianino
    //ATtiny1614
    //
    //Original code:Neil Gershenfeld 12/8/19
    // This work may be reproduced, modified, distributed,
    // performed, and displayed for any purpose, but must
    // acknowledge this project. Copyright is retained and
    // must be preserved. The work is provided as is; no
    // warranty is provided, and users accept all liability.
    //
    
    
    const int ledPin1 = 8;//first light
    const int buttonPin = 10;// button pin
    int buttonState = 0;//initial state of the button
    int i = 0; //variable intensity led
    
    void setup() { //declaration of inputs and outputs
      pinMode(ledPin1, OUTPUT);
      pinMode(buttonPin, INPUT);
    }
    void loop() {
      buttonState = digitalRead(buttonPin);// we read the state of the button
      if (buttonState == HIGH) { //if we press the button
      digitalWrite(ledPin1, HIGH);
      delay(500);                       
      digitalWrite(ledPin1, LOW);    
      delay(500);
      digitalWrite(ledPin1, HIGH);
      delay(500);                       
      digitalWrite(ledPin1, LOW);    
      delay(500);
      digitalWrite(ledPin1, HIGH);
      delay(2000);                        
      digitalWrite(ledPin1, LOW);    
      delay(1000);
      
    }
      else {  //if we don't press the button
      digitalWrite(ledPin1, LOW);
      }
    }

    Pyroelectric

    A passive infrared sensor (or PIR sensor) is an electronic sensor that measures infrared (IR) light radiated from objects in its field of view. They are mainly used in PIR-based motion detectors.

  • Connection and schematic
  • In this case we only need three cables; one for VCC, another for GND and another for the sensor output that in our case we will connect it to pin PA4 (0 in Arduino).

  • Programming
  • Here you will find the programming to use a digital sensor such as the PIR. Here you can find the Arduino and Processing files to download.

    - Arduino Hello PIR

    - Processing Hello PIR

    //Fab Academy 2020 - Fab Lab León
    //PIR sensor                            
    //Adrianino
    //ATtiny1614
    
    
    const int RadarPin = 0; // digital input pin to hook the sensor to
    int value = 6; // variable to store the value coming from the sensor
    void setup()
    {
      Serial.begin(115200); // initialize serial communications
      pinMode(RadarPin, INPUT); //digital input pin
    }
     
    void loop()
    {
      int value= digitalRead(RadarPin); // read the value from the sensor (0 or 1)
      Serial.println(value);  // print value to Serial Monitor
    }

    Doppler radar

    The RCWL-0516 is a Dopler Microwave Radar Sensor.It is an alternative to traditional PIR infrared motion detectors. Faced with these, it has certain differences, which will be an advantage or disadvantage depending on the needs of our project.

    First of all, PIR sensors require the moving object to have a temperature difference from the environment. For this reason, they are able to detect people, but not moving objects. In contrast, the RCWL-0516 detects any object that is moving, regardless of its temperature. On the other hand, PIR sensors have sensitivity problems when the ambient temperature is high. The RCWL-0516, on the other hand, does not have this problem and works correctly between -20ºC to 80ºC. In terms of detection range, the RCWL-0516 has a greater range than PIR sensors, being able to easily reach 5-7 meters of range.

    Finally, the RCWL-0516 is omnidirectional, that is, it detects movement in 360º. This is a difference from PIR sensors, which have a certain "angle of view". There are even versions of PIR with a narrow beam, for example to control windows or doors.

  • Connection and schematic
  • In this case we only need three cables; one for VCC, another for GND and another for the sensor output that in our case we will connect it to pin PA4 (0 in Arduino).

  • Programming
  • Here you will find the programming to use a digital sensor such as the PIR. Here you can find the Arduino and Processing files to download.

    - Arduino Hello Radar

    - Processing Hello Radar

    //Fab Academy 2020 - Fab Lab León
    //Doppler radar                            
    //Adrianino
    //ATtiny1614
    
    
    const int RadarPin = 0; // digital input pin to hook the sensor to
    int value = 6; // variable to store the value coming from the sensor
    void setup()
    {
      Serial.begin(115200); // initialize serial communications
      pinMode(RadarPin, INPUT); //digital input pin
    }
     
    void loop()
    {
      int value= digitalRead(RadarPin); // read the value from the sensor (0 or 1)
      Serial.println(value);  // print value to Serial Monitor
    }

    Ultrasonic sensor

    The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats do. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package. It comes complete with ultrasonic transmitter and receiver modules.

  • Connection and schematic
  • In this case we only need four cables; one for VCC, one for GND, another cable for the Trigger (PA4, Arduino pin 0) and another for the Echo (PA5, Arduino pin 1).

  • Programming
  • Here you will find the programming to use a digital sensor such as the Ultrasonic sensor. Here you can find the Arduino and Processing files to download.

    - Arduino Hello Ultrasonic sensor

    - Processing Hello Ultrasonic sensor

    //Fab Academy 2020 - Fab Lab León
    //Ultrasonic sensor
    //Adrianino
    //ATtiny1614
    
    
    
    const int EchoPin = 1;
    const int TriggerPin = 0;
     
    void setup() {
       Serial.begin(115200);
       pinMode(TriggerPin, OUTPUT);
       pinMode(EchoPin, INPUT);
    }
     
    void loop() {
       int cm = ping(TriggerPin, EchoPin);
      Serial.print("");
       Serial.println(cm);
       delay(1000);
    }
     
    int ping(int TriggerPin, int EchoPin) {
       long duration, distanceCm;
       
       digitalWrite(TriggerPin, LOW);  //to generate a clean pulse we set LOW 4us
       delayMicroseconds(4);
       digitalWrite(TriggerPin, HIGH);  //we generate Trigger (trigger) of 10us
       delayMicroseconds(10);
       digitalWrite(TriggerPin, LOW);
       
       duration = pulseIn(EchoPin, HIGH);  //we measure the time between pulses, in microseconds
       
       distanceCm = duration * 10 / 292/ 2;   //we convert distance, in cm
       return distanceCm;
    }

    Time of flight

    I use a module that integrates the VL53L0X sensor. The module is sold by Adafruit, although in my case I bought it from Amazon. In this case of the pinout that the sensor brings, I will only use the VCC, GND, SDA and SCL pins. This information is obtained from the Luis Llamas website.

  • Connection and schematic
  • In this case we only need four cables; one for VCC, one for GND, another cable for the SDA (PB1, Arduino pin 6) and another for the SCL (PB0, Arduino pin 7).

  • Programming
  • Here you will find the programming to use the Time of Flight sensor. Here you can find the Arduino and Processing files to download.

    - Arduino Time of Flight sensor

    - Processing Time of Flight sensor

    //Fab Academy 2020 - Fab Lab León
    //Time of Flight                           
    //Adrianino
    //ATtiny1614
    
    /* This example shows how to get single-shot range
     measurements from the VL53L0X. The sensor can optionally be
     configured with different ranging profiles, as described in
     the VL53L0X API user manual, to get better performance for
     a certain application. This code is based on the four
     "SingleRanging" examples in the VL53L0X API.
    
     The range readings are in units of mm. */
    
    #include Wire.h
    #include VL53L0X.h
    
    VL53L0X sensor;
    
    
    // Uncomment this line to use long range mode. This
    // increases the sensitivity of the sensor and extends its
    // potential range, but increases the likelihood of getting
    // an inaccurate reading because of reflections from objects
    // other than the intended target. It works best in dark
    // conditions.
    
    //#define LONG_RANGE
    
    
    // Uncomment ONE of these two lines to get
    // - higher speed at the cost of lower accuracy OR
    // - higher accuracy at the cost of lower speed
    
    //#define HIGH_SPEED
    //#define HIGH_ACCURACY
    
    
    void setup()
    {
      Serial.begin(115200);
      Wire.begin();
    
      sensor.setTimeout(500);
      if (!sensor.init())
      {
        Serial.println("Failed to detect and initialize sensor!");
        while (1) {}
      }
    
    #if defined LONG_RANGE
      // lower the return signal rate limit (default is 0.25 MCPS)
      sensor.setSignalRateLimit(0.1);
      // increase laser pulse periods (defaults are 14 and 10 PCLKs)
      sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
      sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
    #endif
    
    #if defined HIGH_SPEED
      // reduce timing budget to 20 ms (default is about 33 ms)
      sensor.setMeasurementTimingBudget(20000);
    #elif defined HIGH_ACCURACY
      // increase timing budget to 200 ms
      sensor.setMeasurementTimingBudget(200000);
    #endif
    }
    
    void loop()
    {
      Serial.print(sensor.readRangeSingleMillimeters());
      if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
    
      Serial.println();
    }

    Hall effect

    The Hall effect sensor or simply Hall sensor or Hall probe uses the Hall effect to measure magnetic fields or currents or to determine the position in which it is.

  • Connection and schematic
  • In this case, being a component without a module, I create my own. I design and manufacture a small board where I solder the hall effect sensor and with the flat connectors where there is no room for mistakes when connecting it. I use the analog input of the ATtiny1614 PA4 (Arduino pin 0).

    Here you can find the design in Eagle and the PNG's to create the board.

    - Hall effect Schematic + Board

    - Hall effect traces

  • Programming
  • Here you will find the programming to use an analog sensor such as the Hall effect sensor. Here you can find the Arduino and Processing files to download.

    - Arduino Hello Hall effect sensor

    - Processing Hello Hall effect sensor

    //Fab Academy 2020 - Fab Lab León
    //Hall effect
    //Adrianino
    //ATtiny1614
    
    
    int sensorPin = 0;    // analog input pin to hook the sensor to
    int sensorValue = 0;  // variable to store the value coming from the sensor
     
    void setup() {
      Serial.begin(115200); // initialize serial communications
    }
     
    void loop() {
      sensorValue = analogRead(sensorPin); // read the value from the sensor
      sensorValue = map(sensorValue, 0, 1024, 1024, 0);
      Serial.println(sensorValue); // print value to Serial Monitor
      //mySerial.println("x"); // print value "x" to Serial Monitor
      delay(500); // short delay so we can actually see the numbers
    }

    Temperature. NTC.

    The NTC sensor is a type of resistance whose value varies as a function of temperature in a more pronounced way than a common resistance. Its operation is based on the variation of the resistivity that a semiconductor presents with temperature.

  • Connection and schematic
  • In this case, being a component without a module, I create my own. I design and manufacture a small board where I solder the NTC sensor, a 10K resistor and with the flat connectors where there is no room for mistakes when connecting it. I use the analog input of the ATtiny1614 PA4 (Arduino pin 0).

    Here you can find the design in Eagle and the PNG's to create the board.

    - NTC Schematic + Board

    - NTC traces

  • Programming
  • Here you will find the programming to use an analog sensor such as the NTC sensor. Here you can find the Arduino and Processing files to download.

    - Arduino Hello NTC Temperature sensor

    - Processing Hello NTC Temperature sensor

    //Fab Academy 2020 - Fab Lab León
    //NTC
    //Adrianino
    //ATtiny1614
    int sensorPin = 0;    // analog input pin to hook the sensor to
    int sensorValue = 0;  // variable to store the value coming from the sensor
     
    void setup() {
      Serial.begin(115200); // initialize serial communications
    }
     
    void loop() {
      sensorValue = analogRead(sensorPin); // read the value from the sensor
      sensorValue = map(sensorValue, 482, 890, 19, 180);
      Serial.println(sensorValue); // print value to Serial Monitor
      //mySerial.println("x"); // print value "x" to Serial Monitor
      delay(500); // short delay so we can actually see the numbers
    }

    Phototransistor. Visible.

    The Phototransistor sensor is a three-layer semiconductor device which has a light-sensitive base region. The base senses the light and converts it into the current which flows between the collector and the emitter region.

  • Connection and schematic
  • In this case, being a component without a module, I create my own. I design and manufacture a small board where I solder the Phototransistor sensor, a 10K resistor and with the flat connectors where there is no room for mistakes when connecting it. I use the analog input of the ATtiny1614 PA4 (Arduino pin 0).

    Here you can find the design in Eagle and the PNG's to create the board.

    - Phototransistor Schematic + Board

    - Phototransistor traces

  • Programming
  • Here you will find the programming to use an analog sensor such as the Phototransistor sensor. Here you can find the Arduino and Processing files to download.

    - Arduino Hello Phototransistor sensor

    - Processing Hello Phototransistor sensor

    //Fab Academy 2020 - Fab Lab León
    //Phototransistor
    //Adrianino
    //ATtiny1614
    int sensorPin = 0;    // analog input pin to hook the sensor to
    int sensorValue = 0;  // variable to store the value coming from the sensor
     
    void setup() {
      Serial.begin(115200); // initialize serial communications
    }
     
    void loop() {
      sensorValue = analogRead(sensorPin); // read the value from the sensor
      sensorValue = map(sensorValue, 0, 1024, 1024, 0);
      Serial.println(sensorValue); // print value to Serial Monitor
      //mySerial.println("x"); // print value "x" to Serial Monitor
      delay(500); // short delay so we can actually see the numbers
    }

    Phototransistor. IR.

    The Phototransistor IR sensor is a three-layer semiconductor device which has a light-sensitive base region. The base senses the IR and converts it into the current which flows between the collector and the emitter region.

  • Connection and schematic
  • In this case, being a component without a module, I create my own. I design and manufacture a small board where I solder the Phototransistor IR sensor, a 10K resistor, a IR LED, a 1K resistor and with the flat connectors where there is no room for mistakes when connecting it. I use the analog input of the ATtiny1614 PA4 (Arduino pin 0).

    Here you can find the design in Eagle and the PNG's to create the board.

    - Phototransistor IR Schematic + Board

    - Phototransistor IR traces

  • Programming
  • Here you will find the programming to use an analog sensor such as the Phototransistor sensor. Here you can find the Arduino and Processing files to download.

    - Arduino Hello Phototransistor IR sensor

    - Processing Hello Phototransistor IR sensor

    /******************************************************************************
    QRD1114_Proximity_Example.ino
    Example sketch for SparkFun's QRD1114 Reflectance Proximity Sensor
      (https://www.sparkfun.com/products/246)
    Jim Lindblom @ SparkFun Electronics
    May 2, 2016
    
    Modified by Adrián Torres Omaña
    
    Phototransistor IR
    Adrianino
    ATtiny1614
    
    ******************************************************************************/
    const int Sensor = 0; // Sensor output voltage
    
    void setup() 
    {
      Serial.begin(115200);
      pinMode(Sensor, INPUT);
    }
    
    void loop() 
    {
      // Read in the ADC and convert it to a voltage:
      int proximityADC = analogRead(Sensor);
      float proximityV = (float)proximityADC * 5.0 / 1023.0;
      Serial.println(proximityV);
      delay(100);
    }

    Outputs

    RGB LED

    The RGB LED stands for Red, Blue and Green LEDs. RGB LED products combine these three colors to produce more than 16 million shades of light.

  • Connection and schematic
  • In this case, being a component without a module, I create my own. I design and manufacture a small board where I solder the RGB LED, two 1K resistors (for red and green color), a 499 resistor (for blue color) and with the flat connectors where there is no room for mistakes when connecting it. I use the digitals ouputs of the ATtiny1614 PA4 (Arduino pin 0), PA5 (Arduino pin 1), PA6 (Arduino pin 2).

    Here you can find the design in Eagle and the PNG's to create the board.

    - RGB LED Schematic + Board

    - RGB LED traces

  • Programming
  • Here you will find the programming to use a RGB LED. Here you can find the Arduino file to download.

    - Arduino Hello RGB LED

    //Fab Academy 2020 - Fab Lab León
    //RGB LED
    //Adrianino
    //ATtiny1614
      
      const byte COLOR_BLACK = 0b000;
      const byte COLOR_BLUE = 0b100;
      const byte COLOR_RED = 0b010;
      const byte COLOR_GREEN = 0b001;
      const byte COLOR_MAGENTA = 0b101;
      const byte COLOR_CYAN = 0b011;
      const byte COLOR_YELLOW = 0b110;
      const byte COLOR_WHITE = 0b111;
    
    
      const byte PIN_LED_R = 0;
      const byte PIN_LED_G = 2;
      const byte PIN_LED_B = 1;
    
    
      void setup() {
    
        pinMode(PIN_LED_R, OUTPUT);
        pinMode(PIN_LED_G, OUTPUT);
        pinMode(PIN_LED_B, OUTPUT);
        displayColor(COLOR_BLACK);
      }
    
    
      void loop() {
    
    
        displayColor(COLOR_RED);
        delay(1000);
    
        displayColor(COLOR_GREEN);
        delay(1000);
    
        displayColor(COLOR_BLUE);
        delay(1000);
    
        displayColor(COLOR_MAGENTA);
        delay(1000);
    
        displayColor(COLOR_CYAN);
        delay(1000);
    
        displayColor(COLOR_YELLOW);
        delay(1000);
    
        displayColor(COLOR_WHITE);
        delay(1000);
    
        displayColor(COLOR_BLACK);
        delay(1000);
        
      }
    
      void displayColor(byte color) {
    
        digitalWrite(PIN_LED_R, !bitRead(color, 0));
        digitalWrite(PIN_LED_G, !bitRead(color, 2));
        digitalWrite(PIN_LED_B, !bitRead(color, 1));
      }

    LCD - I2C

    For this example I am going to use an LCD with an I2C communication module. In my case, I bought it through Amazon from AZDelivery, here is the link. This company has a multitude of very interesting tutorials, including that of the LCD module with I2C.

  • Connection and schematic
  • In this case we only need four cables; one for VCC, one for GND, another cable for the SDA and SCL, the I2C connection.

  • Programming
  • When we use the I2C communication protocol, the first thing we must do is identify the different slaves that we connect to the bus. The same happens when we connect an input or an output, they have to have a name to identify themselves on the bus; is usually 0x... To do this I use Neil's program to see what number the I2C interface of the LCD uses. On this link you can find the addresses of the different input and output modules that use the I2C communication protocol.

    - Arduino Hello I2C

    //
    // hello.I2C.ino
    //
    // I2C hello-world scanner
    //
    // Neil Gershenfeld 12/8/19
    //
    // This work may be reproduced, modified, distributed,
    // performed, and displayed for any purpose, but must
    // acknowledge this project. Copyright is retained and
    // must be preserved. The work is provided as is; no
    // warranty is provided, and users accept all liability.
    //
    
    #include Wire.h
    
    void setup() {
       Serial.begin(115200);
       Wire.begin();
       }
    
    uint8_t address,count;
    
    void loop() {
       count = 0;
       Serial.println("start scan ...");
       for (address = 1; address < 127; address++) {
          Wire.beginTransmission (address);
          if (Wire.endTransmission () == 0) {
             count += 1;
             Serial.print("   found ");
             Serial.print(address,DEC);
             Serial.print(" (0x");
             Serial.print(address,HEX);
             Serial.println (")");
             }
          }
       if (count == 0)
          Serial.println("   no devices found");
       delay(1000);
       }
       

    Once the program is loaded through the UPDI, we connect the LCD to the board and the FTDI to the computer. In the terminal we execute the instruction to see the number on the LCD. Listen the serial port python -m serial.tools.miniterm /dev/ttyUSB0 115200

    In my case the number is 0x27.

    Once I know what the LCD number is, I go on to test Neil's program, Hello_LCD.

    - Arduino LCD Hello World

    //
    // hello.LCD.I2C.ino
    //
    // LCD I2C hello-world
    //
    // Neil Gershenfeld 12/8/19
    //
    // This work may be reproduced, modified, distributed,
    // performed, and displayed for any purpose, but must
    // acknowledge this project. Copyright is retained and
    // must be preserved. The work is provided as is; no
    // warranty is provided, and users accept all liability.
    //
    
    #include LiquidCrystal_PCF8574.h
    #include Wire.h
    
    LiquidCrystal_PCF8574 lcd(0x27); // set LCD address 0x27
    int count = 0;
    
    void setup() {
       lcd.begin(16,2); // initialize 16x2 LCD
       //lcd.begin(20,4); // initialize 20x4 LCD
       lcd.setBacklight(255); // turn on backlight
       lcd.home(); // go home
       lcd.clear(); // clear display
       lcd.print("Hello World!"); // print text
       lcd.setCursor(0,1); // move cursor
       lcd.print("Count: ");
       }
    
    void loop() {
       lcd.print(count);
       lcd.setCursor(7,1);
       count += 1;
       }
       

    OLED

    For this example I am going to use an OLED with an I2C communication module. In my case, I bought it through Amazon from AZDelivery, here is the link. This company has a multitude of very interesting tutorials, including that of the OLED module with I2C.

  • Connection and schematic
  • In this case we only need four cables; one for VCC, one for GND, another cable for the SDA and SCL, the I2C connection.

  • Programming
  • When we use the I2C communication protocol, the first thing we must do is identify the different slaves that we connect to the bus. The same happens when we connect an input or an output, they have to have a name to identify themselves on the bus; is usually 0x... To do this I use Neil's program to see what number the I2C interface of the OLED uses. On this link you can find the addresses of the different input and output modules that use the I2C communication protocol.

    - Arduino Hello I2C

    //
    // hello.I2C.ino
    //
    // I2C hello-world scanner
    //
    // Neil Gershenfeld 12/8/19
    //
    // This work may be reproduced, modified, distributed,
    // performed, and displayed for any purpose, but must
    // acknowledge this project. Copyright is retained and
    // must be preserved. The work is provided as is; no
    // warranty is provided, and users accept all liability.
    //
    
    #include Wire.h
    
    void setup() {
       Serial.begin(115200);
       Wire.begin();
       }
    
    uint8_t address,count;
    
    void loop() {
       count = 0;
       Serial.println("start scan ...");
       for (address = 1; address < 127; address++) {
          Wire.beginTransmission (address);
          if (Wire.endTransmission () == 0) {
             count += 1;
             Serial.print("   found ");
             Serial.print(address,DEC);
             Serial.print(" (0x");
             Serial.print(address,HEX);
             Serial.println (")");
             }
          }
       if (count == 0)
          Serial.println("   no devices found");
       delay(1000);
       }
       

    Once the program is loaded through the UPDI, we connect the OLED to the board and the FTDI to the computer. In the terminal we execute the instruction to see the number on the LCD. Listen the serial port python -m serial.tools.miniterm /dev/ttyUSB0 115200

    In my case the number is 0x3C.

    Once I know what the OLED number is, I go on to test Hello_OLED program. You will need to install the Adafruit SSD1306 and GFX libraries. If you need more information you can follow the following tutorial.

    - Arduino Hello_OLED

    /*********
      Rui Santos
      Complete project details at https://randomnerdtutorials.com  
    *********/
    //Fab Academy 2020 - Fab Lab León
    //OLED
    //Adrianino
    //ATtiny1614
    
    #include Wire.h
    #include Adafruit_GFX.h
    #include Adafruit_SSD1306.h
    
    #define SCREEN_WIDTH 128 // OLED display width, in pixels
    #define SCREEN_HEIGHT 64 // OLED display height, in pixels
    
    // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
    Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); // // Reset pin # (or -1 if sharing Arduino reset pin)
    
    void setup() {
      Serial.begin(115200);
    
      if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x64
        Serial.println(F("SSD1306 allocation failed"));
        for(;;);
      }
      delay(2000);
      display.clearDisplay();
    
      display.setTextSize(1);
      display.setTextColor(WHITE);
      display.setCursor(0, 5);
      // Display static text
      display.println("Hello, world!");
      display.setCursor(0, 20);
      display.println("Fab Academy 2020");
      display.println("Adrianino");
      display.display(); 
    }
    
    void loop() {
      
    }

    DC Motor

    To control a DC motor we will use an H bridge, such as the Allegro A4953. With this driver we can control all types of motors through PWM signals.

  • Connection and schematic
  • In this case, being a component without a module, I create my own. I design and manufacture a small board where I solder the Allegro A4953 driver, a 1uF capacitor, a 10uF capacitor and with the flat connectors where there is no room for mistakes when connecting it. It includes two traces to feed with the 9V battery. I use two digital output of the ATtiny1614 PA4 (Arduino pin 0) and PA5 (Arduino pin 1).

    Here you can find the design in Eagle and the PNG's to create the board.

    - Motor Schematic + Board

    - Motor traces

  • Programming
  • Here you can find a program that moves the motor, but when you press the button it stops, and when you release it, it starts again, accelerating progressively. Here you can find the Arduino file to download.

    - Arduino Hello Motor

    //Fab Academy 2020 - Fab Lab León
    //Motor
    //Adrianino
    //ATtiny1614
    const int switch1Pin = 10;     // switch 1        
    const int motor1Pin = 0;      // H-bridge pin 0 (in2) 
    const int motor2Pin = 1;      // H-bridge pin 1 (in1) 
    
    void setup() {
        // set the switch pins as input pins and activate their internal pull up resistors
        // so they are not in a floating state because their default state is now HIGH
        pinMode(switch1Pin, INPUT); 
       
    
        // set H-bridge pins as outputs:
        pinMode(motor1Pin, OUTPUT);
        pinMode(motor2Pin, OUTPUT);
      }
    
    void loop() {
        // if switch1 is pressed, (=LOW because the unpressed 'pulled up' state is HIGH)
       
      if (digitalRead(switch1Pin) == LOW) {
          analogWrite(motor1Pin, 127); // set pin 1 of the H-bridge to 50% using PWM
          analogWrite(motor2Pin, 0);   // set pin 2 of the H-bridge to low state
        }
         // if neither of the switches are pressed, the motor will stand still
      else
          {
          digitalWrite(motor1Pin, LOW);   // set pin 1 of the H-bridge low
          digitalWrite(motor2Pin, LOW);   // set pin 2 of the H-bridge low
          }
      }

    Servo motor

    A very common output is a servo. A servomotor is a device similar to a direct current motor that has the ability to be located in any position within its operating range, and remain stable in that position. In this case I use a 0 to 180 degree servo.

  • Connection and schematic
  • In this case we only need three cables; one for VCC, another for GND and another for the signal output that in our case we will connect it to pin PA4 (0 in Arduino). The circuit can be powered by a 9V battery.

  • Programming
  • Here you will find the programming to use a servo motor. Here you can find the Arduino file to download.

    - Arduino Servo

    //Original code Elena Cardiel Fab Academy 2019
    //Fab Academy 2020 - Fab Lab León
    //Servo                           
    //Adrianino
    //ATtiny1614
    
    #include Servo.h
    
    
    Servo myservo;  // crea el objeto servo
     
    int pos = 0;    // posicion del servo
     
    void setup() {
    
      myservo.attach(0);  // vincula el servo al pin digital PA4
      
    }
     
    void loop() {
       //varia la posicion de 0 a 160, con esperas de 30ms
       for (pos = 0; pos <= 160; pos += 2) 
       {
          myservo.write(pos);              
          delay(80);                       
       }
     
       //varia la posicion de 0 a 160, con esperas de 30ms
       for (pos = 160; pos >= 0; pos -= 2) 
       {
          myservo.write(pos);              
          delay(80);                       
       }
    }

    Conclusions

    My idea of creating Adrianino has been so that anyone who does the Fab Academy has no fear of electronics. It has the evolution of the UPDI + VCC, which avoids the need to have an FTDI connected to power the board. It is a modular board that everyone can test the different inputs and outputs that appear in the following photo.

    Files

    Find below the files that I made for this project.