├── Hardware ├── Qduino_Mini.brd └── Qduino_Mini.sch ├── Image └── cover.jpg ├── LICENSE.md ├── README.md └── Software ├── Qduino.zip ├── Qduino ├── MAX17048 datasheet.pdf ├── Qduino.cpp ├── Qduino.h └── examples │ ├── batteryLeveltoRGB │ └── batteryLeveltoRGB.ino │ ├── fuelGauge │ └── fuelGauge.ino │ └── rgbLED │ └── rgbLED.ino ├── package_qtechknow_index.json └── qduinomini.tar.bz2 /Image/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MightyQ/Qduino_Mini/85d6e5c1f73de0dbe9e3360dbb073e3acfea5be5/Image/cover.jpg -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) {{{year}}} {{{fullname}}} 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Qduino Mini](https://github.com/MightyQ/Qduino_Mini/blob/master/Image/cover.jpg "Image") 2 | 3 | The Qduino Mini is *perfect* to embed in your electronics projects, it's super small, inexpensive, has a battery connector & charger built-in, & a fuel gauge that can tell you when to charge the battery! 4 | 5 | The **Qduino Mini is Arduino-compatible & 100% open source, hardware and software** meaning that making and programming your first circuit is a breeze. Hardware is hard, so we decided to make it a little bit easier. All of the design files, including EAGLE board files, schematic, and code have been released under an open source license. Here's what it includes: 6 | 7 | * **Battery Charger Circuit** - just plug in USB and it charges the battery with the auto switching circuit - there's no extra charger needed & no digging the battery out of your project so you can charge & program at the same time over USB! 8 | * **Battery Fuel Gauge** - guessing on when your project runs out of juice? We've got you covered - we have a simple monitor library for your battery so you can remind yourself when it needs a little extra juice. 9 | * **Ultra small, Ultra thin, Ultra light** - The Qduino Mini itself is 0.8in x 1.5in (2cm x 3.9cm) & 0.18oz (5 grams), perfect for quadcopters, drones or high altitude balloon projects. Both the Qduino Mini and the batteries (LiPos) used to power the board fit are super compact & thin, just right for embedding in your projects. 10 | 11 | ######Tech Specs: 12 | 13 | * **ATmega32U4 Processor** - Arduino Leonardo Compatible 14 | * 32KB Flash Storage 15 | * 2.5KB SRAM 16 | * 1KB EEPROM 17 | * 3.3V @ 8MHz 18 | * 20 Digital I/O // 14 Dedicated 19 | * 12 Analog Channels // 6 Dedicated 20 | * 7 Digital I/O also PWM channels 21 | * SPI, I2C, UART available 22 | * Two RGB LEDs built-in - one for: Charge Status, TX, RX, and the * other user programmable 23 | * **TPS78233** 3.3V 150mA Regulator 24 | * **MCP73832** LiPo Battery Charger 25 | * **MAX17048** LiPo Battery Fuel Gauge 26 | 27 | The Qduino Mini is 100% made in the USA! Every board is made and quality tested at SparkFun Electronics, in Niwot, CO. -------------------------------------------------------------------------------- /Software/Qduino.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MightyQ/Qduino_Mini/85d6e5c1f73de0dbe9e3360dbb073e3acfea5be5/Software/Qduino.zip -------------------------------------------------------------------------------- /Software/Qduino/MAX17048 datasheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MightyQ/Qduino_Mini/85d6e5c1f73de0dbe9e3360dbb073e3acfea5be5/Software/Qduino/MAX17048 datasheet.pdf -------------------------------------------------------------------------------- /Software/Qduino/Qduino.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Qduino Mini library w/MAX1704* Driver & RGB PWM control * 4 | * * 5 | * MAX1704+ Driver Forked From: * 6 | * Matthew Newberry * 7 | * mattnewberry@me.com * 8 | * * 9 | *************************************************************************** 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU License. * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU License V2 for more details. * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include "Arduino.h" 21 | #include "Qduino.h" 22 | #include "Wire.h" 23 | 24 | void qduino::setup(){ 25 | 26 | pinMode(13, OUTPUT); 27 | digitalWrite(13, HIGH); 28 | pinMode(11, OUTPUT); 29 | digitalWrite(11, HIGH); 30 | pinMode(10, OUTPUT); 31 | digitalWrite(10, HIGH); 32 | } 33 | 34 | void qduino::setRGB(int r, int g, int b){ 35 | 36 | // ratio for R:G:B is 4:7:7 for forward voltage 37 | 38 | r = 255 - r; // set all values to opposite values 39 | g = 255 - g; // because LED is common anode 40 | b = 255 - b; 41 | 42 | int newr = map(r, 0, 255, 0, 146); 43 | 44 | analogWrite(10, newr); 45 | analogWrite(11, g); 46 | analogWrite(13, b); 47 | } 48 | 49 | void qduino::setRGB(Color color){ 50 | 51 | switch (color) { 52 | case RED: 53 | analogWrite(10, 0); 54 | analogWrite(11, 255); 55 | analogWrite(13, 255); 56 | break; 57 | case GREEN: 58 | analogWrite(10, 255); 59 | analogWrite(11, 0); 60 | analogWrite(13, 255); 61 | break; 62 | case BLUE: 63 | analogWrite(10, 255); 64 | analogWrite(11, 255); 65 | analogWrite(13, 0); 66 | break; 67 | case CYAN: 68 | analogWrite(10, 255); 69 | analogWrite(11, 0); 70 | analogWrite(13, 0); 71 | break; 72 | case PINK: 73 | analogWrite(10, 109); 74 | analogWrite(11, 255); 75 | analogWrite(13, 0); 76 | break; 77 | case WHITE: 78 | analogWrite(10, 109); 79 | analogWrite(11, 0); 80 | analogWrite(13, 0); 81 | break; 82 | case PURPLE: 83 | analogWrite(10, 210); 84 | analogWrite(11, 255); 85 | analogWrite(13, 0); 86 | break; 87 | case YELLOW: 88 | analogWrite(10, 100); 89 | analogWrite(11, 0); 90 | analogWrite(13, 255); 91 | break; 92 | case ORANGE: 93 | analogWrite(10, 109); 94 | analogWrite(11, 150); 95 | analogWrite(13, 255); 96 | break; 97 | } 98 | } 99 | 100 | void qduino::rainbow(int duration){ 101 | 102 | unsigned int rgbColor[3]; 103 | 104 | int newduration = map(duration, 1, 5, 500, 3000); 105 | 106 | // Start off with red. 107 | rgbColor[0] = 255; 108 | rgbColor[1] = 0; 109 | rgbColor[2] = 0; 110 | 111 | // Choose the colours to increment and decrement. 112 | for (int decColor = 0; decColor < 3; decColor += 1) { 113 | int incColor = decColor == 2 ? 0 : decColor + 1; 114 | 115 | // cross-fade the two colours. 116 | for(int i = 0; i < 255; i += 1) { 117 | rgbColor[decColor] -= 1; 118 | rgbColor[incColor] += 1; 119 | 120 | analogWrite(10, rgbColor[0]); 121 | analogWrite(11, rgbColor[1]); 122 | analogWrite(13, rgbColor[2]); 123 | delayMicroseconds(newduration); 124 | } 125 | } 126 | } 127 | 128 | void qduino::ledOff(){ 129 | 130 | analogWrite(10, 255); 131 | analogWrite(11, 255); 132 | analogWrite(13, 255); 133 | 134 | } 135 | 136 | int fuelGauge::chargePercentage(){ 137 | 138 | byte msb = 0; 139 | byte lsb = 0; 140 | 141 | readFrom(MAX1704_SOC,msb,lsb); 142 | 143 | int fraction = lsb / 256; 144 | int percentage = msb + fraction; 145 | 146 | return percentage; 147 | } 148 | 149 | void fuelGauge::setup(){ 150 | reset(); 151 | performCommand(MAX1704_QUICK_START, 0x00); // aka quickStart(); 152 | } 153 | 154 | void fuelGauge::reset(){ 155 | 156 | performCommand(MAX1704_POWER_ON_RESET, 0x00); 157 | } 158 | 159 | char fuelGauge::getVersion(){ 160 | 161 | int value = 0; 162 | byte msb = 0; 163 | byte lsb = 0; 164 | readFrom(MAX1704_VERSION, msb, lsb); 165 | 166 | value = 0xFF00 & (msb<<8); 167 | value |= 0xFF & lsb; 168 | 169 | return value; 170 | } 171 | 172 | void fuelGauge::setThreshold(uint8_t level){ 173 | 174 | Wire.beginTransmission(MAX1704_ADDR); 175 | Wire.write(MAX1704_CONFIG); 176 | Wire.write(MAX1704_ALERT_LEVEL); 177 | Wire.write(32 - level); 178 | Wire.endTransmission(); 179 | } 180 | 181 | int fuelGauge::currentThreshold(){ 182 | 183 | byte msb = 0; 184 | byte lsb = 0; 185 | 186 | readFrom(MAX1704_CONFIG,msb,lsb); 187 | byte threshold = lsb & 0x1f; 188 | 189 | return 32 - threshold; 190 | } 191 | 192 | boolean fuelGauge::inAlert(){ 193 | 194 | byte msb = 0; 195 | byte lsb = 0; 196 | 197 | readFrom(MAX1704_CONFIG,msb,lsb); 198 | byte alert = (lsb >>5) & 0x01; 199 | 200 | return int(alert) == 1; 201 | } 202 | 203 | boolean fuelGauge::inSleep(){ 204 | 205 | byte msb = 0; 206 | byte lsb = 0; 207 | 208 | readFrom(MAX1704_CONFIG,msb,lsb); 209 | byte sleep = (lsb >>7) & 0x01; 210 | 211 | return int(sleep) == 1; 212 | } 213 | 214 | void fuelGauge::goToSleep(){ 215 | byte msb = 0; 216 | byte lsb = 0; 217 | 218 | // Get the current config so we don't wipe any previous settings 219 | readFrom(MAX1704_CONFIG,msb,lsb); 220 | 221 | // Set SLEEP config bit to 1 to enable 222 | lsb |= (1<<7); 223 | 224 | // Update config 225 | Wire.beginTransmission(MAX1704_ADDR); 226 | Wire.write(MAX1704_CONFIG); 227 | Wire.write(msb); 228 | Wire.write(lsb); 229 | Wire.endTransmission(); 230 | 231 | // This delay is here to ensure it's fully asleep before moving on 232 | delay(150); 233 | } 234 | 235 | void fuelGauge::wakeUp(){ 236 | byte msb = 0; 237 | byte lsb = 0; 238 | 239 | // Get the current config so we don't wipe any previous settings 240 | readFrom(MAX1704_CONFIG,msb,lsb); 241 | // Set SLEEP config bit to 0 to disable 242 | lsb &= ~(1<<7); 243 | 244 | // Update config 245 | Wire.beginTransmission(MAX1704_ADDR); 246 | Wire.write(MAX1704_CONFIG); 247 | Wire.write(msb); 248 | Wire.write(lsb); 249 | Wire.endTransmission(); 250 | 251 | // This delay is here to ensure it's fully awake before moving on 252 | delay(150); 253 | } 254 | 255 | void fuelGauge::performCommand(byte address, int value){ 256 | 257 | Wire.beginTransmission(MAX1704_ADDR); 258 | Wire.write(MAX1704_COMMAND); 259 | Wire.write(address); 260 | Wire.write(value); 261 | Wire.endTransmission(); 262 | } 263 | 264 | void fuelGauge::readFrom(byte address, byte &msb, byte &lsb){ 265 | 266 | Wire.beginTransmission(MAX1704_ADDR); 267 | Wire.write(address); 268 | Wire.endTransmission(); 269 | 270 | Wire.requestFrom(MAX1704_ADDR, 2); 271 | 272 | int numread = Wire.available(); 273 | //if (numread == 2) { 274 | msb = Wire.read(); 275 | lsb = Wire.read(); 276 | //} 277 | Wire.endTransmission(); 278 | } 279 | 280 | -------------------------------------------------------------------------------- /Software/Qduino/Qduino.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Qduino Mini library w/MAX1704* Driver & RGB PWM control * 4 | * * 5 | * Forked From: * 6 | * Matthew Newberry * 7 | * mattnewberry@me.com * 8 | * * 9 | *************************************************************************** 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU License. * 13 | * This program is distributed in the hope that it will be useful, * 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 | * GNU License V2 for more details. * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include "Arduino.h" 21 | 22 | #ifndef _Qduino_h 23 | #define _Qduino_h 24 | 25 | #define MAX1704_ADDR 0x36 26 | #define MAX1704_SOC 0x04 27 | #define MAX1704_VERSION 0x08 28 | #define MAX1704_POWER_ON_RESET 0x54 29 | #define MAX1704_QUICK_START 0x40 30 | #define MAX1704_CONFIG 0x0C 31 | #define MAX1704_COMMAND 0xFE 32 | #define MAX1704_ALERT_LEVEL 0x97 33 | 34 | class qduino{ 35 | 36 | public: 37 | enum Color : byte { 38 | RED = 1, 39 | GREEN, 40 | BLUE, 41 | CYAN, 42 | PINK, 43 | WHITE, 44 | PURPLE, 45 | YELLOW, 46 | ORANGE 47 | }; 48 | 49 | void setup(); 50 | void setRGB(int r, int g, int b); 51 | void setRGB(Color color); 52 | void rainbow(int duration); 53 | void ledOff(); 54 | 55 | private: 56 | 57 | }; 58 | 59 | class fuelGauge{ 60 | 61 | public: 62 | int chargePercentage(); 63 | void setup(); 64 | void reset(); 65 | char getVersion(); 66 | void setThreshold(uint8_t level); 67 | int currentThreshold(); 68 | boolean inSleep(); 69 | boolean inAlert(); 70 | void goToSleep(); 71 | void wakeUp(); 72 | 73 | 74 | private: 75 | void performCommand(byte address, int value); 76 | void readFrom(byte address, byte &msb, byte &lsb); 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Software/Qduino/examples/batteryLeveltoRGB/batteryLeveltoRGB.ino: -------------------------------------------------------------------------------- 1 | /* Qduino Fuel Gauge / RGB LED 2 | 3 | This sketch demonstrates both the RGB LED and the 4 | battery fuel gauge -> the RGB LED is green when 75% 5 | or more full, yellow 50% - 74%, orange 25% - 49%, red 6 | when battery is less than 25% full. 7 | 8 | Fuel Gauge Drivers forked from Matt Newberry 9 | 10 | created on 25 May 15 11 | made by Quin Etnyre 12 | */ 13 | 14 | #include "Arduino.h" 15 | #include "Wire.h" 16 | #include "Qduino.h" 17 | 18 | fuelGauge battery; // initialize the library 19 | 20 | qduino q; 21 | 22 | void setup(){ 23 | 24 | Wire.begin(); 25 | battery.setup(); 26 | 27 | q.setup(); 28 | 29 | } 30 | 31 | void loop(){ 32 | int charge = battery.chargePercentage(); 33 | battery.reset(); 34 | 35 | if(charge >= 75) { 36 | 37 | q.setRGB(qduino::GREEN); 38 | 39 | } else if(charge >= 50 && charge << 75) { 40 | 41 | q.setRGB(qduino::YELLOW); 42 | 43 | } else if(charge >= 25 && charge << 50) { 44 | 45 | q.setRGB(qduino::ORANGE); 46 | 47 | } else if(charge << 25) { 48 | 49 | q.setRGB(qduino::RED); 50 | } 51 | 52 | delay(1000); 53 | 54 | q.ledOff(); 55 | } 56 | -------------------------------------------------------------------------------- /Software/Qduino/examples/fuelGauge/fuelGauge.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Qduino Mini built-in LiPo Battery Fuel Gauge 3 | 4 | Reads the battery state of charge - make sure the 5 | battery is connected or you will get weird readings! 6 | 7 | Returns the value in percent - check Qduino.cpp for 8 | documentation on how to put the fuel gauge to sleep 9 | and wake it up. 10 | 11 | created by Quin Etnyre 12 | driver forked from Matt Newberry 13 | */ 14 | 15 | #include "Arduino.h" 16 | #include "Wire.h" 17 | #include "Qduino.h" 18 | 19 | fuelGauge battery; // initialize the library 20 | 21 | void setup(){ 22 | 23 | Wire.begin(); 24 | Serial.begin(9600); // start Serial port 25 | battery.setup(); // setup fuel gauge 26 | 27 | while(!Serial); // wait for Serial port to be opened 28 | 29 | Serial.println("Begin"); 30 | } 31 | 32 | void loop(){ 33 | int charge = battery.chargePercentage(); // get % 34 | battery.reset(); // reset for next data request 35 | Serial.print(charge); // print out the battery % 36 | Serial.println("%"); 37 | delay(1000); // wait a second to read again 38 | } 39 | -------------------------------------------------------------------------------- /Software/Qduino/examples/rgbLED/rgbLED.ino: -------------------------------------------------------------------------------- 1 | /* Qduino RGB LED Example 2 | 3 | This example controls the user RGB LED near the top 4 | of the board. 5 | 6 | Possible colors for setRGB(color) function: 7 | 8 | red 9 | orange 10 | yellow 11 | green 12 | cyan 13 | blue 14 | purple 15 | pink 16 | white 17 | 18 | created on 30 Jun 15 19 | made by Quin Etnyre 20 | */ 21 | 22 | #include "Qduino.h" 23 | #include "Wire.h" 24 | 25 | qduino q; // initialize the library 26 | 27 | void setup() { 28 | 29 | q.setup(); 30 | 31 | } 32 | 33 | void loop() { 34 | 35 | q.setRGB(100, 150, 200); // r, g, b values 36 | 37 | delay(500); 38 | 39 | q.setRGB(qduino::RED); 40 | 41 | delay(500); 42 | 43 | q.setRGB(qduino::ORANGE); 44 | 45 | delay(500); 46 | 47 | q.setRGB(qduino::YELLOW); 48 | 49 | delay(500); 50 | 51 | q.setRGB(qduino::GREEN); 52 | 53 | delay(500); 54 | 55 | q.setRGB(qduino::CYAN); 56 | 57 | delay(500); 58 | 59 | q.setRGB(qduino::BLUE); 60 | 61 | delay(500); 62 | 63 | q.setRGB(qduino::PURPLE); 64 | 65 | delay(500); 66 | 67 | q.setRGB(qduino::PINK); 68 | 69 | delay(500); 70 | 71 | q.setRGB(qduino::WHITE); 72 | 73 | delay(500); 74 | 75 | q.rainbow(3); // number between 1&5 76 | 77 | q.ledOff(); 78 | 79 | delay(500); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /Software/package_qtechknow_index.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages":[ 3 | { 4 | "name":"Qduino Mini", 5 | "maintainer":"Qtechknow", 6 | "websiteURL":"https://SparkFun.com", 7 | "email":"TechSupport@SparkFun.com", 8 | "help":{ 9 | "online":"https://forum.sparkfun.com" 10 | }, 11 | "platforms":[ 12 | { 13 | "name":"Qtechknow Boards", 14 | "architecture":"avr", 15 | "version":"1.0.0", 16 | "category":"Qtechknow", 17 | "url":"https://github.com/sparkfun/Qduino_Mini/raw/master/Software/qduinomini.tar.bz2", 18 | "archiveFileName":"qduinomini.tar.bz2", 19 | "checksum":"SHA-256:722d86c8053b4f5624edd0d784257d6a83b5b57425cee247d8a43622804b0768", 20 | "size":"2394237", 21 | "help":{ 22 | "online":"https://forums.sparkfun.com" 23 | }, 24 | "boards":[ 25 | { 26 | "name":"Qduino Mini" 27 | } 28 | ], 29 | "toolsDependencies":[ 30 | { 31 | "packager":"arduino", 32 | "name":"avr-gcc", 33 | "version":"4.8.1-arduino5" 34 | }, 35 | { 36 | "packager":"arduino", 37 | "name":"avrdude", 38 | "version":"6.0.1-arduino5" 39 | } 40 | ] 41 | } 42 | ], 43 | "tools":[] 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /Software/qduinomini.tar.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MightyQ/Qduino_Mini/85d6e5c1f73de0dbe9e3360dbb073e3acfea5be5/Software/qduinomini.tar.bz2 --------------------------------------------------------------------------------