My fabmate Pedro Chana and I measured the consuption of the ATtiny1614 board and the OLED display. You have it here.
Measuring the power consumption of the BLDC motor for my final project
Dealing with high power BLDC motors and Lithium batteries requires a good control of the current and power consumption. If you don't control them properly it can harm the motors and the battery.
So I made a first test of the BLCD motor, connected to a power supply. This way I know that the current is going to be limited by the supply.
As you can see, the currents goes up to 3 amps (on the display of the power supply), so the power consumption is 36V x 3 amps= 108 W. The battery I'm going to use is able to supply 30 amps, so the power will go up to 1 KW.
Finally, I connected the BLDC motor to a battery (limiting the current to 1 amp), and I measured the current with an ampere meter clamp. It says 0.96 amps.
Individual assignment:
Add an output device to a microcontroller board you've designed, and program it to do something.
SAMD11 board controlling stepper motors
Two weeks ago I made a general purpose SAMD11 board and I'm using it to control some external devices. I programmed it with the boatloader, so I could program it directly through the USB port. Here is the detail of the board production.
So, first thing, I checked the programming of the SAMD11 from the Arduino IDE through the USB port, selecting the following parameters:
I programmed a simple led blinking program to check everything works:
It worked well, with external and internal leds, so I went on to program an output device, a stepper motor.
I had a simple stepper from an Arduino kit, the 28BYJ-48, a low cost unipolar motor:
This Unipolar Stepper Motor 28-BYJ48 is provided with five wires and four coils. The center connections of the coils are tied together and usually used as the power connection. They are named unipolar steppers because power always comes in on this one pole.
SPECIFICATION
- A, B, C, D four-phase LED indicates the status of the stepper motor work. - Stepper motor with a standard interface, when used directly pluggable. - 5 lines 4 phase can be used for ordinary ULN2003 chip driver, connect to the 2 phase, support the development board, with convenient use, direct docking. - Rated Voltage: DC5V 4-phase - Insulation Resistance: >10MΩ (500V) - Dielectric Strength: 600V AC / 1mA / 1s - Step angle: 5.625 x 1/64 - DC Resistance: 200Ω±7% (25C) - Reduction ratio: 1/64 - Insulation Grade: A - No-load Pull-in Frequency: >600Hz - No-load Pull out Frequency: >1000Hz - Pull in Torque: >34.3mN.m(120Hz) - Detent Torque: >34.3mN.m - Temperature Rise: < 40K(120Hz)
It has a step angle of 5.625 (64 steps per turn) and an internal reduction of 1/64, so the amount of steps to complete a turn is 4096. Later I discovered that the reduction is not exactly 64, and the real number of steps per turn is 4076.
I added a 5V pin to my board, so I powered the motor with the 5V Vcc of the USB port (the voltage of the SAMD11 is 3.3 V).
The motor comes with the ULN2003 controller. The ULN2003 stepper motor driver PCB provides a direct drive interface between your microcontroller and stepper motor. The PCB provides 4 inputs for connection to your microcontroller, power supply connection for the stepper motor voltage, and ON/OFF jumper, a direct connect stepper motor header and 4 LEDs to indicate stepping state.
There are several sequences to move the motor. I chose a half-step sequence, to move the motor smoothly:
I connected 4 pins of the SAMD11 board (8,9,14,15) to the controller, and programmed an alternate movement (back and forth) with increasing angles:
The program worked the first time without problems, moving the motor at the specified angles.
After that, I wanted to try other output devices, as the OLED display and the adressable led stripe. We have some AZDelivery 128x64 OLED displays.
I found that the Adafruit libraries used to control de display were too big for the SAMD11 memory. Perhaps I could do it deleting the bootload or programming it directly in C, but I decided to try it later.
I also had some problems with the libraries to control the led strip (FastLED). I got the following error:
error: #error "This platform isn't recognized by FastLED... yet. See comments in FastLED/led_sysdefs.h for options."
The ATtiny1614 generic board
At that point I decided to make an ATtiny1614 generic board, so I could control the OLED display and other devices. The board will have UPDI and FTDI interfaces, and 8 input/output pins, along with VCC and GND on every connector. Also a LED to check power and a capacitor to filter high frequencies and stabilize the power supply.
I like to have GND all around the circuit, so it's easier to connect everything to it, and the MCU in the center:
As I was at home, I used the Genmitsu 3018 ProVer to make the board. This time I had it well calibrated and with a setup I knew it was going to work:
A cut depth of 0.1 mm, a "simulated" end mill of 0.65 mm (I was using a V-shaped mill) and a feed rate of 70 mm/min.
The result was a pretty good board:
Using Atmel ICE to program the 1614 board
This time I hadn't the programmer we have at the lab, so I think it could be programmed by the Atmel-ICE. To power to the board I used a power supply of 5V. The most difficult thing for me was to set the correct pins of the UPDI interface on the Atmel ICE side:
After that I programmed the board with the simple led-blinking program and it worked well. So I tried to program the OLED display. I connected VCC, GND, SCL and SDA and programmed it with a "Hello world" program, but nothing happened. Then I changed the adress of the I2C interface from 0x3C to 03D, and even 0x78, because the last one was printed on the OLED display as the I2C address. Nothing.
if (error == 0) { Serial.print("I2C device found at address 0x"); if (address < 16) Serial.print("0");
Serial.print(address,HEX); Serial.println(" !");
nDevices++; } else if (error==4) { Serial.print("Unknown error at address 0x"); if (address < 16) Serial.print("0");
Serial.println(address,HEX); } }
if (nDevices == 0) Serial.println("No I2C devices found"); else Serial.println("done");
delay(5000); // wait 5 seconds for next scan }
But the scanner couldn't find any device. So I thought perhaps the OLED display was wrong. As it was Sunday I decided to try another display on monday morning.
When I arrived at the lab I tried another OLED display and I worked without problems. This is the hello program I used: