Week 9 (Input Devices)
Week 9
Week 9
Do to the global and local problems I don’t a lot of choices for MCU selection. I have a limited amount of ATtiny 1614. I’ll make a PCB that has I2C communication, servo motor pins, and pins for a sensor. To make this PCB I’ll be using my Shapeoko Pro. Then I jumped in eagle to make the schematic and trances for my PCB. After finishing this I exported the trace to a png file.
In the design process of this PCB, I received a lot of support from my friend/instructor Adrián Torres . I also studied a lot his Adrianino. In my PCB prototype I needed to gain more hands-on experience to add the appropriate modifications if needed. For started I added some pins to power the board with a battery if needed, FTDI port for serial communication with my laptop and 5V input, I2C port for easy connectivity with a variety of input and output devices, and easy access to UPDI port for programming. Thanks to a mod made by Adrian we can program the PCB with only 3 pins. No need to connect the FTDI for power while programing the board.
Diving more in I2C serial communication, I’ll be using my friends Adrián Torres Repo as a reference. I’ll also used Electronoob’s video that covers a better explanation on networking using I2C. I2C is a type of synchronous (needs a clock to send data) serial communication. What I like of this type communication is that you only need 4 pins to execute it and there is a variety of inputs and outputs that take advantage of it to communicate with the chosen MCU. The pins are VDD, GND, SDA (pin that sends the data) and SCL (Clock needed to send data).
The following screenshots are from the YouTube video of Electronoob’s. They help describe how the concept of the Master and slave devices work. The “MASTER” is the transmitter (TX) and the “SLAVES” are the receptors (RX). To have good communication as a requirement it’s really important that you give each “SLAVE” an address. I2C has a maximum quantity of 127 “SLAVES” in the BUS (main communication lines).
After exportin the monochrome picture I take the file in InkScape to use trace BitMap to generate vectors to import them in Carveco. I used a special end mill with the fallowing parameters:
This sensor conveniently communicates through I2C. I can directly connect the to the I2C pins on my PCB. Adafruit has flawless documentation of their devices. So it wasn’t that hard to make it work first with an Arduino mega. You can use the examples provided by Adafruit to see a basic code of the different modes this little PCB has. I decided to use retrieve three axis orientation data using Euler’s Angles. You can even use a temperature senor that implements in this little board.
#include <Wire.h> #include <Adafruit_Sensor.h> #include <Adafruit_BNO055.h> #include <utility/imumaths.h> Adafruit_BNO055 bno = Adafruit_BNO055(55); void setup(void) { Serial.begin(9600); Serial.println("Orientation Sensor Test"); Serial.println(""); /* Initialise the sensor */ if(!bno.begin()) { /* There was a problem detecting the BNO055 ... check your connections */ Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!"); while(1); } delay(1000); bno.setExtCrystalUse(true); } void loop(void) { imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER); /* Display the floating point data */ Serial.print("X: "); Serial.print(euler.x()); Serial.print(" Y: "); Serial.print(euler.y()); Serial.print(" Z: "); Serial.print(euler.z()); Serial.println(""); }
Make (Almost) Anything