├── .gitignore ├── .vscode ├── extensions.json └── settings.json ├── src ├── rtc.h ├── sensor.h ├── ui.h ├── heater.h ├── heater.cpp ├── main.cpp ├── sensor.cpp ├── state.h ├── rtc.cpp └── ui.cpp ├── docs └── DESIGN.md ├── lib ├── Adafruit-PCD8544-Nokia-5110-LCD-library-master │ ├── library.properties │ ├── README.txt │ ├── license.txt │ ├── Adafruit_PCD8544.h │ ├── Adafruit_PCD8544.cpp │ └── examples │ │ └── pcdtest │ │ └── pcdtest.ino └── readme.txt ├── platformio.ini ├── pcb ├── .gitignore ├── PCD8544.lbr ├── main.brd ├── ArduinoNanoV30.lbr └── main.sch ├── include └── readme.txt └── .travis.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .vscode/ipch 4 | .vscode/.browse.c_cpp.db* 5 | .vscode/c_cpp_properties.json 6 | .vscode/launch.json 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "terminal.integrated.env.linux": { 3 | "PATH": "/home/teq/.platformio/penv/bin:/home/teq/.platformio/penv:/home/teq/.nvm/versions/node/v10.6.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin", 4 | "PLATFORMIO_CALLER": "vscode" 5 | } 6 | } -------------------------------------------------------------------------------- /src/rtc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "state.h" 6 | 7 | class RTC { 8 | 9 | public: 10 | 11 | RTC(State& appState); 12 | 13 | void setup(void); 14 | 15 | bool readTime(bool throttle = true); 16 | 17 | 18 | private: 19 | 20 | State& state; 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /src/sensor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "state.h" 6 | 7 | /** Responsible for sensor reading */ 8 | class Sensor { 9 | 10 | public: 11 | 12 | Sensor(State& appState); 13 | 14 | void setup(void); 15 | 16 | bool readTemperature(bool throttle = true); 17 | 18 | private: 19 | 20 | State& state; 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /docs/DESIGN.md: -------------------------------------------------------------------------------- 1 | Fetures: 2 | - Display: Nokia 5110 / PCD8544 (SPI) + backlight with hardware (!) PWM 3 | - Controls: 4 buttons with software debounce 4 | - Clock: PCF8583 (or DS?) 5 | - Temperature control: 6 | - DS18B20 (OneWire) digital thermometer 7 | - 1 channel with software PWM for heater 8 | - Automatic light on/off: 2 channels 9 | - (?) Automatic feeder 10 | - (?) Remote control via nRF24L01 11 | -------------------------------------------------------------------------------- /lib/Adafruit-PCD8544-Nokia-5110-LCD-library-master/library.properties: -------------------------------------------------------------------------------- 1 | name=Adafruit PCD8544 Nokia 5110 LCD library 2 | version=1.0.1 3 | author=Adafruit 4 | maintainer=Adafruit 5 | sentence=Arduino driver for PC8544, most commonly found in small Nokia 5110's 6 | paragraph=Arduino driver for PC8544, most commonly found in small Nokia 5110's 7 | category=Display 8 | url=https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library 9 | architectures=* 10 | -------------------------------------------------------------------------------- /src/ui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "state.h" 4 | 5 | /** Responsible for UI rendering */ 6 | class UI { 7 | 8 | public: 9 | 10 | UI(State& appState); 11 | 12 | void setup(void); 13 | 14 | void clock1kHz(void); 15 | 16 | void render(void); 17 | 18 | void react(void); 19 | 20 | private: 21 | 22 | void renderHome(void); 23 | void reactHome(void); 24 | void renderMenu(void); 25 | void reactMenu(void); 26 | 27 | State& state; 28 | 29 | }; 30 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:nanoatmega328] 12 | platform = atmelavr 13 | board = nanoatmega328 14 | framework = arduino 15 | lib_deps = 16 | Adafruit GFX Library 17 | OneWire 18 | DallasTemperature 19 | TimerOne 20 | 1197 ; RTCLib by NeiroN 21 | ClickEncoder 22 | -------------------------------------------------------------------------------- /src/heater.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "state.h" 6 | 7 | /** Represents a heater controlled by PWM */ 8 | class Heater { 9 | 10 | public: 11 | 12 | Heater(State& appState); 13 | 14 | /** Setup PWM pin */ 15 | void setup(void); 16 | 17 | /** Trigger PWM clock tick */ 18 | void clock(void); 19 | 20 | /** 21 | * Set heater power 22 | * @param heaterPower Power in percents (0-100) 23 | */ 24 | void setPower(uint8_t heaterPower); 25 | 26 | private: 27 | 28 | State& state; 29 | uint16_t tickCount; 30 | volatile uint16_t endTick; 31 | 32 | }; 33 | -------------------------------------------------------------------------------- /pcb/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore list for Eagle, a PCB layout tool 2 | 3 | # Backup files 4 | *.s#? 5 | *.b#? 6 | *.l#? 7 | *.b$? 8 | *.s$? 9 | *.l$? 10 | 11 | # Eagle project file 12 | # It contains a serial number and references to the file structure 13 | # on your computer. 14 | # comment the following line if you want to have your project file included. 15 | eagle.epf 16 | 17 | # Autorouter files 18 | *.pro 19 | *.job 20 | 21 | # CAM files 22 | *.$$$ 23 | *.cmp 24 | *.ly2 25 | *.l15 26 | *.sol 27 | *.plc 28 | *.stc 29 | *.sts 30 | *.crc 31 | *.crs 32 | 33 | *.dri 34 | *.drl 35 | *.gpi 36 | *.pls 37 | *.ger 38 | *.xln 39 | 40 | *.drd 41 | *.drd.* 42 | 43 | *.s#* 44 | *.b#* 45 | 46 | *.info 47 | 48 | *.eps 49 | 50 | # file locks introduced since 7.x 51 | *.lck 52 | -------------------------------------------------------------------------------- /src/heater.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "heater.h" 4 | 5 | #define HEATER_PIN 9 6 | #define PERIOD_TICKS 1000 7 | 8 | Heater::Heater(State& appState): 9 | state(appState), 10 | tickCount(1), 11 | endTick(0) 12 | { } 13 | 14 | void Heater::setup(void) { 15 | pinMode(HEATER_PIN, OUTPUT); 16 | setPower(0); 17 | } 18 | 19 | void Heater::clock(void) { 20 | 21 | if (endTick < tickCount) { 22 | digitalWrite(HEATER_PIN, HIGH); // off 23 | } else { 24 | digitalWrite(HEATER_PIN, LOW); // on 25 | } 26 | 27 | if (++tickCount > PERIOD_TICKS) { 28 | tickCount = 1; 29 | } 30 | 31 | } 32 | 33 | void Heater::setPower(uint8_t heaterPower) { 34 | float dutyCycle = heaterPower / 100.0; 35 | endTick = PERIOD_TICKS * dutyCycle; 36 | state.heaterPower = heaterPower; 37 | } 38 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "state.h" 4 | #include "rtc.h" 5 | #include "sensor.h" 6 | #include "heater.h" 7 | #include "ui.h" 8 | 9 | State state = { 10 | .screen = Screen::Menu, 11 | .item = Item::SetTemp 12 | }; 13 | 14 | RTC rtc(state); 15 | Sensor sensor(state); 16 | Heater heater(state); 17 | UI ui(state); 18 | 19 | void clock1kHz() { 20 | ui.clock1kHz(); 21 | heater.clock(); 22 | } 23 | 24 | void setup(void) { 25 | 26 | Serial.begin(9600); 27 | 28 | Timer1.initialize(1000); // 1ms period (1kHz) 29 | Timer1.attachInterrupt(clock1kHz); 30 | 31 | rtc.setup(); 32 | sensor.setup(); 33 | heater.setup(); 34 | ui.setup(); 35 | 36 | } 37 | 38 | void loop(void) { 39 | 40 | delay(50); 41 | 42 | rtc.readTime(); 43 | 44 | if (sensor.readTemperature()) { 45 | if (state.actualTemp < state.desiredTemp) { 46 | heater.setPower(50); 47 | } else { 48 | heater.setPower(0); 49 | } 50 | } 51 | 52 | ui.react(); 53 | 54 | ui.render(); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/sensor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "sensor.h" 7 | 8 | #define ONE_WIRE_BUS 2 9 | 10 | OneWire oneWire(ONE_WIRE_BUS); 11 | DallasTemperature sensors(&oneWire); 12 | 13 | Sensor::Sensor(State& appState): 14 | state(appState) 15 | { } 16 | 17 | void Sensor::setup(void) { 18 | 19 | sensors.begin(); 20 | 21 | // Fetch first temperature reading synchronously 22 | sensors.requestTemperatures(); 23 | state.actualTemp = sensors.getTempCByIndex(0); 24 | state.lastActualTemp = millis(); 25 | 26 | // All subsequent readings are asynchronous 27 | sensors.setWaitForConversion(false); 28 | sensors.requestTemperatures(); 29 | 30 | } 31 | 32 | bool Sensor::readTemperature(bool throttle) { 33 | 34 | // Wait at least 1 sec between readings 35 | if (throttle && (millis() - state.lastActualTemp) < 1000) return false; 36 | 37 | state.actualTemp = sensors.getTempCByIndex(0); 38 | sensors.requestTemperatures(); 39 | state.lastActualTemp = millis(); 40 | 41 | return true; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/state.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | /** Defines application state */ 6 | struct State { 7 | 8 | // *** UI **** 9 | 10 | /** Currently active screen */ 11 | uint8_t screen; 12 | /** Currently active screen item */ 13 | uint8_t item; 14 | 15 | /// *** Real time clock *** 16 | 17 | uint8_t rtcDay; 18 | uint8_t rtcMonth; 19 | uint16_t rtcYear; 20 | uint8_t rtcHour; 21 | uint8_t rtcMinute; 22 | uint8_t rtcSecond; 23 | 24 | // *** Temperature sensor **** 25 | 26 | /** Last reading from a temperature sensor */ 27 | float actualTemp; 28 | /** Timestamp of the last reading from a temperature sensor */ 29 | uint32_t lastActualTemp; 30 | /** Desired temperature */ 31 | float desiredTemp; 32 | 33 | // *** Heater *** 34 | 35 | /** PWM duty cycle for the heater */ 36 | uint8_t heaterPower; 37 | 38 | // *** Light **** 39 | 40 | }; 41 | 42 | enum Screen { 43 | Home, 44 | Menu 45 | }; 46 | 47 | enum Item { 48 | // *** Menu screen *** 49 | SetTemp, 50 | SetLamps, 51 | SetClock, 52 | MenuBack 53 | }; 54 | -------------------------------------------------------------------------------- /src/rtc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "rtc.h" 6 | 7 | PCF8583 pcf8583; 8 | 9 | uint32_t lastRead; 10 | 11 | RTC::RTC(State& appState): 12 | state(appState) 13 | { } 14 | 15 | void RTC::setup(void) { 16 | 17 | Wire.begin(); 18 | pcf8583.begin(); 19 | 20 | readTime(false); 21 | 22 | // if (! rtc.isrunning()) { 23 | // Serial.println("RTC is NOT running!"); 24 | // // rtc.adjust(DateTime(__DATE__, __TIME__)); 25 | // } 26 | // else 27 | // { 28 | // Serial.println("RTC OK"); 29 | // // DateTime now = DateTime(2018, 11, 7, 10, 55, 0); 30 | // // rtc.adjust(now); 31 | // } 32 | 33 | } 34 | 35 | bool RTC::readTime(bool throttle) { 36 | 37 | // Wait at least 1 sec between readings 38 | if (throttle && (millis() - lastRead) < 1000) return false; 39 | 40 | DateTime now = pcf8583.now(); 41 | 42 | state.rtcDay = now.day(); 43 | state.rtcMonth = now.month(); 44 | state.rtcYear = now.year(); 45 | state.rtcHour = now.hour(); 46 | state.rtcMinute = now.minute(); 47 | state.rtcSecond = now.second(); 48 | 49 | lastRead = millis(); 50 | 51 | return true; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- readme.txt --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /lib/Adafruit-PCD8544-Nokia-5110-LCD-library-master/README.txt: -------------------------------------------------------------------------------- 1 | This is a library for our Monochrome Nokia 5110 LCD Displays 2 | 3 | Pick one up today in the adafruit shop! 4 | ------> http://www.adafruit.com/products/338 5 | 6 | These displays use SPI to communicate, 4 or 5 pins are required to 7 | interface 8 | 9 | Adafruit invests time and resources providing this open source code, 10 | please support Adafruit and open-source hardware by purchasing 11 | products from Adafruit! 12 | 13 | Written by Limor Fried/Ladyada for Adafruit Industries. 14 | BSD license, check license.txt for more information 15 | All text above must be included in any redistribution 16 | 17 | To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_PCD8544. Check that the Adafruit_PCD8544 folder contains Adafruit_PCD8544.cpp and Adafruit_PCD8544.h 18 | 19 | Place the Adafruit_PCD8544 library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. 20 | 21 | You will also have to download the Adafruit GFX Graphics core which does all the circles, text, rectangles, etc. You can get it from 22 | https://github.com/adafruit/Adafruit-GFX-Library 23 | and download/install that library as well -------------------------------------------------------------------------------- /include/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /lib/Adafruit-PCD8544-Nokia-5110-LCD-library-master/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2012, Adafruit Industries 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. Neither the name of the copyright holders nor the 14 | names of its contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < https://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < https://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < https://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choose one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # - platformio update 39 | # 40 | # script: 41 | # - platformio run 42 | 43 | 44 | # 45 | # Template #2: The project is intended to be used as a library with examples. 46 | # 47 | 48 | # language: python 49 | # python: 50 | # - "2.7" 51 | # 52 | # sudo: false 53 | # cache: 54 | # directories: 55 | # - "~/.platformio" 56 | # 57 | # env: 58 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 59 | # - PLATFORMIO_CI_SRC=examples/file.ino 60 | # - PLATFORMIO_CI_SRC=path/to/test/directory 61 | # 62 | # install: 63 | # - pip install -U platformio 64 | # - platformio update 65 | # 66 | # script: 67 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 68 | -------------------------------------------------------------------------------- /src/ui.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "ui.h" 9 | 10 | Adafruit_PCD8544 display = Adafruit_PCD8544(3, 4, 5); 11 | ClickEncoder encoder(A0, A1, -1, 1); 12 | 13 | void format2(char *buf, uint8_t val, uint8_t max) { 14 | if (val > max) { 15 | buf[0] = 'E'; 16 | buf[1] = 'E'; 17 | } else { 18 | buf[0] = '0' + val / 10; 19 | buf[1] = '0' + val % 10; 20 | } 21 | } 22 | 23 | void invert(bool flag) { 24 | if (flag) { 25 | display.setTextColor(WHITE, BLACK); 26 | } else { 27 | display.setTextColor(BLACK, WHITE); 28 | } 29 | } 30 | 31 | UI::UI(State& appState): 32 | state(appState) 33 | { } 34 | 35 | void UI::setup(void) { 36 | display.begin(); 37 | display.setContrast(55); 38 | encoder.setAccelerationEnabled(true); 39 | } 40 | 41 | void UI::clock1kHz(void) { 42 | encoder.service(); 43 | } 44 | 45 | void UI::render(void) { 46 | 47 | display.clearDisplay(); 48 | display.setFont(NULL); 49 | display.setCursor(0, 0); 50 | 51 | switch (state.screen) { 52 | 53 | case Screen::Menu: 54 | renderMenu(); 55 | break; 56 | 57 | default: 58 | case Screen::Home: 59 | renderHome(); 60 | break; 61 | 62 | } 63 | 64 | display.display(); 65 | 66 | } 67 | 68 | void UI::react(void) { 69 | 70 | switch (state.screen) { 71 | 72 | case Screen::Menu: 73 | reactMenu(); 74 | break; 75 | 76 | default: 77 | case Screen::Home: 78 | reactHome(); 79 | break; 80 | 81 | } 82 | 83 | } 84 | 85 | void UI::renderHome(void) { 86 | 87 | display.setFont(&FreeSerifBold18pt7b); 88 | display.setCursor(0, 24); 89 | 90 | char str[] = "hh:mm"; 91 | format2(&str[0], state.rtcHour, 23); 92 | format2(&str[3], state.rtcMinute, 59); 93 | display.print(str); 94 | 95 | display.setFont(NULL); 96 | display.setCursor(0, 32); 97 | display.print("Temp: "); 98 | display.println(state.actualTemp); 99 | 100 | } 101 | 102 | void UI::reactHome(void) { 103 | 104 | } 105 | 106 | void UI::renderMenu(void) { 107 | 108 | display.println("Settings"); 109 | display.drawLine(0, 8, display.width()-1, 8, BLACK); 110 | 111 | display.setCursor(0, 10); 112 | invert(state.item == Item::SetTemp); display.println("Temperature"); 113 | invert(state.item == Item::SetLamps); display.println("Lamps"); 114 | invert(state.item == Item::SetClock); display.println("Set Clock"); 115 | invert(state.item == Item::MenuBack); display.println("< Back <"); 116 | invert(false); 117 | 118 | } 119 | 120 | void UI::reactMenu(void) { 121 | 122 | int16_t newItem = state.item + encoder.getValue(); 123 | 124 | if (newItem < SetTemp) { 125 | newItem = SetTemp; 126 | } else if (newItem > MenuBack) { 127 | newItem = MenuBack; 128 | } 129 | 130 | state.item = newItem; 131 | 132 | } 133 | -------------------------------------------------------------------------------- /lib/Adafruit-PCD8544-Nokia-5110-LCD-library-master/Adafruit_PCD8544.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | This is a library for our Monochrome Nokia 5110 LCD Displays 3 | 4 | Pick one up today in the adafruit shop! 5 | ------> http://www.adafruit.com/products/338 6 | 7 | These displays use SPI to communicate, 4 or 5 pins are required to 8 | interface 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen must be included in any redistribution 17 | *********************************************************************/ 18 | #ifndef _ADAFRUIT_PCD8544_H 19 | #define _ADAFRUIT_PCD8544_H 20 | 21 | #if defined(ARDUINO) && ARDUINO >= 100 22 | #include "Arduino.h" 23 | #else 24 | #include "WProgram.h" 25 | #include "pins_arduino.h" 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(__SAM3X8E__) || defined(ARDUINO_ARCH_SAMD) 31 | typedef volatile RwReg PortReg; 32 | typedef uint32_t PortMask; 33 | #else 34 | typedef volatile uint8_t PortReg; 35 | typedef uint8_t PortMask; 36 | #endif 37 | 38 | 39 | #define BLACK 1 40 | #define WHITE 0 41 | 42 | #define LCDWIDTH 84 43 | #define LCDHEIGHT 48 44 | 45 | #define PCD8544_POWERDOWN 0x04 46 | #define PCD8544_ENTRYMODE 0x02 47 | #define PCD8544_EXTENDEDINSTRUCTION 0x01 48 | 49 | #define PCD8544_DISPLAYBLANK 0x0 50 | #define PCD8544_DISPLAYNORMAL 0x4 51 | #define PCD8544_DISPLAYALLON 0x1 52 | #define PCD8544_DISPLAYINVERTED 0x5 53 | 54 | // H = 0 55 | #define PCD8544_FUNCTIONSET 0x20 56 | #define PCD8544_DISPLAYCONTROL 0x08 57 | #define PCD8544_SETYADDR 0x40 58 | #define PCD8544_SETXADDR 0x80 59 | 60 | // H = 1 61 | #define PCD8544_SETTEMP 0x04 62 | #define PCD8544_SETBIAS 0x10 63 | #define PCD8544_SETVOP 0x80 64 | 65 | // Default to max SPI clock speed for PCD8544 of 4 mhz (16mhz / 4) for normal Arduinos. 66 | // This can be modified to change the clock speed if necessary (like for supporting other hardware). 67 | #define PCD8544_SPI_CLOCK_DIV SPI_CLOCK_DIV4 68 | 69 | class Adafruit_PCD8544 : public Adafruit_GFX { 70 | public: 71 | // Software SPI with explicit CS pin. 72 | Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, int8_t CS, int8_t RST); 73 | // Software SPI with CS tied to ground. Saves a pin but other pins can't be shared with other hardware. 74 | Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, int8_t RST); 75 | // Hardware SPI based on hardware controlled SCK (SCLK) and MOSI (DIN) pins. CS is still controlled by any IO pin. 76 | // NOTE: MISO and SS will be set as an input and output respectively, so be careful sharing those pins! 77 | Adafruit_PCD8544(int8_t DC, int8_t CS, int8_t RST); 78 | 79 | void begin(uint8_t contrast = 40, uint8_t bias = 0x04); 80 | 81 | void command(uint8_t c); 82 | void data(uint8_t c); 83 | 84 | void setContrast(uint8_t val); 85 | void clearDisplay(void); 86 | void display(); 87 | 88 | void drawPixel(int16_t x, int16_t y, uint16_t color); 89 | uint8_t getPixel(int8_t x, int8_t y); 90 | 91 | private: 92 | int8_t _din, _sclk, _dc, _rst, _cs; 93 | volatile PortReg *mosiport, *clkport; 94 | PortMask mosipinmask, clkpinmask; 95 | 96 | void spiWrite(uint8_t c); 97 | bool isHardwareSPI(); 98 | }; 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /pcb/PCD8544.lbr: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | PCD8544 with header on the bottom edge 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Nokia 5110 (PCD5844) display module 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 48 x 84 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /lib/Adafruit-PCD8544-Nokia-5110-LCD-library-master/Adafruit_PCD8544.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | This is a library for our Monochrome Nokia 5110 LCD Displays 3 | 4 | Pick one up today in the adafruit shop! 5 | ------> http://www.adafruit.com/products/338 6 | 7 | These displays use SPI to communicate, 4 or 5 pins are required to 8 | interface 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen below must be included in any redistribution 17 | *********************************************************************/ 18 | 19 | //#include 20 | #include 21 | #if defined(ARDUINO) && ARDUINO >= 100 22 | #include "Arduino.h" 23 | #else 24 | #include "WProgram.h" 25 | #endif 26 | 27 | #ifdef __AVR__ 28 | #include 29 | #endif 30 | 31 | #ifndef _BV 32 | #define _BV(x) (1 << (x)) 33 | #endif 34 | 35 | #include 36 | 37 | #include 38 | #include "Adafruit_PCD8544.h" 39 | 40 | #ifndef _BV 41 | #define _BV(bit) (1<<(bit)) 42 | #endif 43 | 44 | 45 | // the memory buffer for the LCD 46 | uint8_t pcd8544_buffer[LCDWIDTH * LCDHEIGHT / 8]; 47 | 48 | 49 | // reduces how much is refreshed, which speeds it up! 50 | // originally derived from Steve Evans/JCW's mod but cleaned up and 51 | // optimized 52 | // #define enablePartialUpdate 53 | 54 | #ifdef enablePartialUpdate 55 | static uint8_t xUpdateMin, xUpdateMax, yUpdateMin, yUpdateMax; 56 | #endif 57 | 58 | 59 | 60 | static void updateBoundingBox(uint8_t xmin, uint8_t ymin, uint8_t xmax, uint8_t ymax) { 61 | #ifdef enablePartialUpdate 62 | if (xmin < xUpdateMin) xUpdateMin = xmin; 63 | if (xmax > xUpdateMax) xUpdateMax = xmax; 64 | if (ymin < yUpdateMin) yUpdateMin = ymin; 65 | if (ymax > yUpdateMax) yUpdateMax = ymax; 66 | #endif 67 | } 68 | 69 | Adafruit_PCD8544::Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, 70 | int8_t CS, int8_t RST) : Adafruit_GFX(LCDWIDTH, LCDHEIGHT) { 71 | _din = DIN; 72 | _sclk = SCLK; 73 | _dc = DC; 74 | _rst = RST; 75 | _cs = CS; 76 | } 77 | 78 | Adafruit_PCD8544::Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, 79 | int8_t RST) : Adafruit_GFX(LCDWIDTH, LCDHEIGHT) { 80 | _din = DIN; 81 | _sclk = SCLK; 82 | _dc = DC; 83 | _rst = RST; 84 | _cs = -1; 85 | } 86 | 87 | Adafruit_PCD8544::Adafruit_PCD8544(int8_t DC, int8_t CS, int8_t RST): 88 | Adafruit_GFX(LCDWIDTH, LCDHEIGHT) { 89 | // -1 for din and sclk specify using hardware SPI 90 | _din = -1; 91 | _sclk = -1; 92 | _dc = DC; 93 | _rst = RST; 94 | _cs = CS; 95 | } 96 | 97 | 98 | // the most basic function, set a single pixel 99 | void Adafruit_PCD8544::drawPixel(int16_t x, int16_t y, uint16_t color) { 100 | if ((x < 0) || (x >= _width) || (y < 0) || (y >= _height)) 101 | return; 102 | 103 | int16_t t; 104 | switch(rotation){ 105 | case 1: 106 | t = x; 107 | x = y; 108 | y = LCDHEIGHT - 1 - t; 109 | break; 110 | case 2: 111 | x = LCDWIDTH - 1 - x; 112 | y = LCDHEIGHT - 1 - y; 113 | break; 114 | case 3: 115 | t = x; 116 | x = LCDWIDTH - 1 - y; 117 | y = t; 118 | break; 119 | } 120 | 121 | if ((x < 0) || (x >= LCDWIDTH) || (y < 0) || (y >= LCDHEIGHT)) 122 | return; 123 | 124 | // x is which column 125 | if (color) 126 | pcd8544_buffer[x+ (y/8)*LCDWIDTH] |= _BV(y%8); 127 | else 128 | pcd8544_buffer[x+ (y/8)*LCDWIDTH] &= ~_BV(y%8); 129 | 130 | updateBoundingBox(x,y,x,y); 131 | } 132 | 133 | 134 | // the most basic function, get a single pixel 135 | uint8_t Adafruit_PCD8544::getPixel(int8_t x, int8_t y) { 136 | if ((x < 0) || (x >= LCDWIDTH) || (y < 0) || (y >= LCDHEIGHT)) 137 | return 0; 138 | 139 | return (pcd8544_buffer[x+ (y/8)*LCDWIDTH] >> (y%8)) & 0x1; 140 | } 141 | 142 | 143 | void Adafruit_PCD8544::begin(uint8_t contrast, uint8_t bias) { 144 | if (isHardwareSPI()) { 145 | // Setup hardware SPI. 146 | SPI.begin(); 147 | SPI.setClockDivider(PCD8544_SPI_CLOCK_DIV); 148 | SPI.setDataMode(SPI_MODE0); 149 | SPI.setBitOrder(MSBFIRST); 150 | } 151 | else { 152 | // Setup software SPI. 153 | 154 | // Set software SPI specific pin outputs. 155 | pinMode(_din, OUTPUT); 156 | pinMode(_sclk, OUTPUT); 157 | 158 | // Set software SPI ports and masks. 159 | clkport = portOutputRegister(digitalPinToPort(_sclk)); 160 | clkpinmask = digitalPinToBitMask(_sclk); 161 | mosiport = portOutputRegister(digitalPinToPort(_din)); 162 | mosipinmask = digitalPinToBitMask(_din); 163 | } 164 | 165 | // Set common pin outputs. 166 | pinMode(_dc, OUTPUT); 167 | if (_rst > 0) 168 | pinMode(_rst, OUTPUT); 169 | if (_cs > 0) 170 | pinMode(_cs, OUTPUT); 171 | 172 | // toggle RST low to reset 173 | if (_rst > 0) { 174 | digitalWrite(_rst, LOW); 175 | delay(500); 176 | digitalWrite(_rst, HIGH); 177 | } 178 | 179 | // get into the EXTENDED mode! 180 | command(PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION ); 181 | 182 | // LCD bias select (4 is optimal?) 183 | command(PCD8544_SETBIAS | bias); 184 | 185 | // set VOP 186 | if (contrast > 0x7f) 187 | contrast = 0x7f; 188 | 189 | command( PCD8544_SETVOP | contrast); // Experimentally determined 190 | 191 | 192 | // normal mode 193 | command(PCD8544_FUNCTIONSET); 194 | 195 | // Set display to Normal 196 | command(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL); 197 | 198 | // initial display line 199 | // set page address 200 | // set column address 201 | // write display data 202 | 203 | // set up a bounding box for screen updates 204 | 205 | updateBoundingBox(0, 0, LCDWIDTH-1, LCDHEIGHT-1); 206 | // Push out pcd8544_buffer to the Display (will show the AFI logo) 207 | display(); 208 | } 209 | 210 | 211 | inline void Adafruit_PCD8544::spiWrite(uint8_t d) { 212 | if (isHardwareSPI()) { 213 | // Hardware SPI write. 214 | SPI.transfer(d); 215 | } 216 | else { 217 | // Software SPI write with bit banging. 218 | for(uint8_t bit = 0x80; bit; bit >>= 1) { 219 | *clkport &= ~clkpinmask; 220 | if(d & bit) *mosiport |= mosipinmask; 221 | else *mosiport &= ~mosipinmask; 222 | *clkport |= clkpinmask; 223 | } 224 | } 225 | } 226 | 227 | bool Adafruit_PCD8544::isHardwareSPI() { 228 | return (_din == -1 && _sclk == -1); 229 | } 230 | 231 | void Adafruit_PCD8544::command(uint8_t c) { 232 | digitalWrite(_dc, LOW); 233 | if (_cs > 0) 234 | digitalWrite(_cs, LOW); 235 | spiWrite(c); 236 | if (_cs > 0) 237 | digitalWrite(_cs, HIGH); 238 | } 239 | 240 | void Adafruit_PCD8544::data(uint8_t c) { 241 | digitalWrite(_dc, HIGH); 242 | if (_cs > 0) 243 | digitalWrite(_cs, LOW); 244 | spiWrite(c); 245 | if (_cs > 0) 246 | digitalWrite(_cs, HIGH); 247 | } 248 | 249 | void Adafruit_PCD8544::setContrast(uint8_t val) { 250 | if (val > 0x7f) { 251 | val = 0x7f; 252 | } 253 | command(PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION ); 254 | command( PCD8544_SETVOP | val); 255 | command(PCD8544_FUNCTIONSET); 256 | 257 | } 258 | 259 | 260 | 261 | void Adafruit_PCD8544::display(void) { 262 | uint8_t col, maxcol, p; 263 | 264 | for(p = 0; p < 6; p++) { 265 | #ifdef enablePartialUpdate 266 | // check if this page is part of update 267 | if ( yUpdateMin >= ((p+1)*8) ) { 268 | continue; // nope, skip it! 269 | } 270 | if (yUpdateMax < p*8) { 271 | break; 272 | } 273 | #endif 274 | 275 | command(PCD8544_SETYADDR | p); 276 | 277 | 278 | #ifdef enablePartialUpdate 279 | col = xUpdateMin; 280 | maxcol = xUpdateMax; 281 | #else 282 | // start at the beginning of the row 283 | col = 0; 284 | maxcol = LCDWIDTH-1; 285 | #endif 286 | 287 | command(PCD8544_SETXADDR | col); 288 | 289 | digitalWrite(_dc, HIGH); 290 | if (_cs > 0) 291 | digitalWrite(_cs, LOW); 292 | for(; col <= maxcol; col++) { 293 | spiWrite(pcd8544_buffer[(LCDWIDTH*p)+col]); 294 | } 295 | if (_cs > 0) 296 | digitalWrite(_cs, HIGH); 297 | 298 | } 299 | 300 | command(PCD8544_SETYADDR ); // no idea why this is necessary but it is to finish the last byte? 301 | #ifdef enablePartialUpdate 302 | xUpdateMin = LCDWIDTH - 1; 303 | xUpdateMax = 0; 304 | yUpdateMin = LCDHEIGHT-1; 305 | yUpdateMax = 0; 306 | #endif 307 | 308 | } 309 | 310 | // clear everything 311 | void Adafruit_PCD8544::clearDisplay(void) { 312 | memset(pcd8544_buffer, 0, LCDWIDTH*LCDHEIGHT/8); 313 | updateBoundingBox(0, 0, LCDWIDTH-1, LCDHEIGHT-1); 314 | cursor_y = cursor_x = 0; 315 | } 316 | 317 | /* 318 | // this doesnt touch the buffer, just clears the display RAM - might be handy 319 | void Adafruit_PCD8544::clearDisplay(void) { 320 | 321 | uint8_t p, c; 322 | 323 | for(p = 0; p < 8; p++) { 324 | 325 | st7565_command(CMD_SET_PAGE | p); 326 | for(c = 0; c < 129; c++) { 327 | //uart_putw_dec(c); 328 | //uart_putchar(' '); 329 | st7565_command(CMD_SET_COLUMN_LOWER | (c & 0xf)); 330 | st7565_command(CMD_SET_COLUMN_UPPER | ((c >> 4) & 0xf)); 331 | st7565_data(0x0); 332 | } 333 | } 334 | 335 | } 336 | 337 | */ 338 | -------------------------------------------------------------------------------- /lib/Adafruit-PCD8544-Nokia-5110-LCD-library-master/examples/pcdtest/pcdtest.ino: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | This is an example sketch for our Monochrome Nokia 5110 LCD Displays 3 | 4 | Pick one up today in the adafruit shop! 5 | ------> http://www.adafruit.com/products/338 6 | 7 | These displays use SPI to communicate, 4 or 5 pins are required to 8 | interface 9 | 10 | Adafruit invests time and resources providing this open source code, 11 | please support Adafruit and open-source hardware by purchasing 12 | products from Adafruit! 13 | 14 | Written by Limor Fried/Ladyada for Adafruit Industries. 15 | BSD license, check license.txt for more information 16 | All text above, and the splash screen must be included in any redistribution 17 | *********************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | // Software SPI (slower updates, more flexible pin options): 24 | // pin 7 - Serial clock out (SCLK) 25 | // pin 6 - Serial data out (DIN) 26 | // pin 5 - Data/Command select (D/C) 27 | // pin 4 - LCD chip select (CS) 28 | // pin 3 - LCD reset (RST) 29 | Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3); 30 | 31 | // Hardware SPI (faster, but must use certain hardware pins): 32 | // SCK is LCD serial clock (SCLK) - this is pin 13 on Arduino Uno 33 | // MOSI is LCD DIN - this is pin 11 on an Arduino Uno 34 | // pin 5 - Data/Command select (D/C) 35 | // pin 4 - LCD chip select (CS) 36 | // pin 3 - LCD reset (RST) 37 | // Adafruit_PCD8544 display = Adafruit_PCD8544(5, 4, 3); 38 | // Note with hardware SPI MISO and SS pins aren't used but will still be read 39 | // and written to during SPI transfer. Be careful sharing these pins! 40 | 41 | #define NUMFLAKES 10 42 | #define XPOS 0 43 | #define YPOS 1 44 | #define DELTAY 2 45 | 46 | 47 | #define LOGO16_GLCD_HEIGHT 16 48 | #define LOGO16_GLCD_WIDTH 16 49 | 50 | static const unsigned char PROGMEM logo16_glcd_bmp[] = 51 | { B00000000, B11000000, 52 | B00000001, B11000000, 53 | B00000001, B11000000, 54 | B00000011, B11100000, 55 | B11110011, B11100000, 56 | B11111110, B11111000, 57 | B01111110, B11111111, 58 | B00110011, B10011111, 59 | B00011111, B11111100, 60 | B00001101, B01110000, 61 | B00011011, B10100000, 62 | B00111111, B11100000, 63 | B00111111, B11110000, 64 | B01111100, B11110000, 65 | B01110000, B01110000, 66 | B00000000, B00110000 }; 67 | 68 | void setup() { 69 | Serial.begin(9600); 70 | 71 | display.begin(); 72 | // init done 73 | 74 | // you can change the contrast around to adapt the display 75 | // for the best viewing! 76 | display.setContrast(50); 77 | 78 | display.display(); // show splashscreen 79 | delay(2000); 80 | display.clearDisplay(); // clears the screen and buffer 81 | 82 | // draw a single pixel 83 | display.drawPixel(10, 10, BLACK); 84 | display.display(); 85 | delay(2000); 86 | display.clearDisplay(); 87 | 88 | // draw many lines 89 | testdrawline(); 90 | display.display(); 91 | delay(2000); 92 | display.clearDisplay(); 93 | 94 | // draw rectangles 95 | testdrawrect(); 96 | display.display(); 97 | delay(2000); 98 | display.clearDisplay(); 99 | 100 | // draw multiple rectangles 101 | testfillrect(); 102 | display.display(); 103 | delay(2000); 104 | display.clearDisplay(); 105 | 106 | // draw mulitple circles 107 | testdrawcircle(); 108 | display.display(); 109 | delay(2000); 110 | display.clearDisplay(); 111 | 112 | // draw a circle, 10 pixel radius 113 | display.fillCircle(display.width()/2, display.height()/2, 10, BLACK); 114 | display.display(); 115 | delay(2000); 116 | display.clearDisplay(); 117 | 118 | testdrawroundrect(); 119 | delay(2000); 120 | display.clearDisplay(); 121 | 122 | testfillroundrect(); 123 | delay(2000); 124 | display.clearDisplay(); 125 | 126 | testdrawtriangle(); 127 | delay(2000); 128 | display.clearDisplay(); 129 | 130 | testfilltriangle(); 131 | delay(2000); 132 | display.clearDisplay(); 133 | 134 | // draw the first ~12 characters in the font 135 | testdrawchar(); 136 | display.display(); 137 | delay(2000); 138 | display.clearDisplay(); 139 | 140 | // text display tests 141 | display.setTextSize(1); 142 | display.setTextColor(BLACK); 143 | display.setCursor(0,0); 144 | display.println("Hello, world!"); 145 | display.setTextColor(WHITE, BLACK); // 'inverted' text 146 | display.println(3.141592); 147 | display.setTextSize(2); 148 | display.setTextColor(BLACK); 149 | display.print("0x"); display.println(0xDEADBEEF, HEX); 150 | display.display(); 151 | delay(2000); 152 | 153 | // rotation example 154 | display.clearDisplay(); 155 | display.setRotation(1); // rotate 90 degrees counter clockwise, can also use values of 2 and 3 to go further. 156 | display.setTextSize(1); 157 | display.setTextColor(BLACK); 158 | display.setCursor(0,0); 159 | display.println("Rotation"); 160 | display.setTextSize(2); 161 | display.println("Example!"); 162 | display.display(); 163 | delay(2000); 164 | 165 | // revert back to no rotation 166 | display.setRotation(0); 167 | 168 | // miniature bitmap display 169 | display.clearDisplay(); 170 | display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1); 171 | display.display(); 172 | 173 | // invert the display 174 | display.invertDisplay(true); 175 | delay(1000); 176 | display.invertDisplay(false); 177 | delay(1000); 178 | 179 | // draw a bitmap icon and 'animate' movement 180 | testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_WIDTH, LOGO16_GLCD_HEIGHT); 181 | } 182 | 183 | 184 | void loop() { 185 | 186 | } 187 | 188 | 189 | void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) { 190 | uint8_t icons[NUMFLAKES][3]; 191 | randomSeed(666); // whatever seed 192 | 193 | // initialize 194 | for (uint8_t f=0; f< NUMFLAKES; f++) { 195 | icons[f][XPOS] = random(display.width()); 196 | icons[f][YPOS] = 0; 197 | icons[f][DELTAY] = random(5) + 1; 198 | 199 | Serial.print("x: "); 200 | Serial.print(icons[f][XPOS], DEC); 201 | Serial.print(" y: "); 202 | Serial.print(icons[f][YPOS], DEC); 203 | Serial.print(" dy: "); 204 | Serial.println(icons[f][DELTAY], DEC); 205 | } 206 | 207 | while (1) { 208 | // draw each icon 209 | for (uint8_t f=0; f< NUMFLAKES; f++) { 210 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, BLACK); 211 | } 212 | display.display(); 213 | delay(200); 214 | 215 | // then erase it + move it 216 | for (uint8_t f=0; f< NUMFLAKES; f++) { 217 | display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, WHITE); 218 | // move it 219 | icons[f][YPOS] += icons[f][DELTAY]; 220 | // if its gone, reinit 221 | if (icons[f][YPOS] > display.height()) { 222 | icons[f][XPOS] = random(display.width()); 223 | icons[f][YPOS] = 0; 224 | icons[f][DELTAY] = random(5) + 1; 225 | } 226 | } 227 | } 228 | } 229 | 230 | 231 | void testdrawchar(void) { 232 | display.setTextSize(1); 233 | display.setTextColor(BLACK); 234 | display.setCursor(0,0); 235 | 236 | for (uint8_t i=0; i < 168; i++) { 237 | if (i == '\n') continue; 238 | display.write(i); 239 | //if ((i > 0) && (i % 14 == 0)) 240 | //display.println(); 241 | } 242 | display.display(); 243 | } 244 | 245 | void testdrawcircle(void) { 246 | for (int16_t i=0; i0; i-=5) { 274 | display.fillTriangle(display.width()/2, display.height()/2-i, 275 | display.width()/2-i, display.height()/2+i, 276 | display.width()/2+i, display.height()/2+i, color); 277 | if (color == WHITE) color = BLACK; 278 | else color = WHITE; 279 | display.display(); 280 | } 281 | } 282 | 283 | void testdrawroundrect(void) { 284 | for (int16_t i=0; i=0; i-=4) { 324 | display.drawLine(0, display.height()-1, display.width()-1, i, BLACK); 325 | display.display(); 326 | } 327 | delay(250); 328 | 329 | display.clearDisplay(); 330 | for (int16_t i=display.width()-1; i>=0; i-=4) { 331 | display.drawLine(display.width()-1, display.height()-1, i, 0, BLACK); 332 | display.display(); 333 | } 334 | for (int16_t i=display.height()-1; i>=0; i-=4) { 335 | display.drawLine(display.width()-1, display.height()-1, 0, i, BLACK); 336 | display.display(); 337 | } 338 | delay(250); 339 | 340 | display.clearDisplay(); 341 | for (int16_t i=0; i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | <b>Arduino Nano V3.0</b><br> 72 | <p>The Nano was designed and is being produced by Gravitech.<br> 73 | 74 | <a href="http://www.gravitech.us/arna30wiatp.html">Gravitech Arduino Nano V3.0</a></p> 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | >NAME 122 | >VALUE 123 | 124 | Reset 125 | 1 126 | Mini-B USB 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | ICSP 138 | 139 | 140 | 141 | 142 | 143 | 144 | PCD8544 with header on the bottom edge 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | <b>EAGLE Design Rules</b> 171 | <p> 172 | Die Standard-Design-Rules sind so gewählt, dass sie für 173 | die meisten Anwendungen passen. Sollte ihre Platine 174 | besondere Anforderungen haben, treffen Sie die erforderlichen 175 | Einstellungen hier und speichern die Design Rules unter 176 | einem neuen Namen ab. 177 | <b>EAGLE Design Rules</b> 178 | <p> 179 | The default Design Rules have been set to cover 180 | a wide range of applications. Your particular design 181 | may have different requirements, so please make the 182 | necessary adjustments and save your customized 183 | design rules under a new name. 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | -------------------------------------------------------------------------------- /pcb/ArduinoNanoV30.lbr: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | <b>Arduino Nano V3.0</b><br> 62 | <p>The Nano was designed and is being produced by Gravitech.<br> 63 | 64 | <a href="http://www.gravitech.us/arna30wiatp.html">Gravitech Arduino Nano V3.0</a></p> 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | >NAME 112 | >VALUE 113 | 114 | Reset 115 | 1 116 | Mini-B USB 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | ICSP 128 | 129 | 130 | 131 | 132 | <b>Arduino Nano V3.0</b><br><br> 133 | 134 | <b>Overview:</b><br> 135 | 136 | The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.x) or ATmega168 (Arduino Nano 2.x). It has more or less the same functionality of the Arduino Duemilanove, but in a different package. It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one.<br> 137 | The Nano was designed and is being produced by Gravitech.<br><br> 138 | 139 | <b>Specifications:</b> 140 | <table border="1" style="width:auto"> 141 | <tr> 142 | <td>Microcontroller</td> 143 | <td>Atmel ATmega168 or ATmega328</td> 144 | </tr> 145 | <tr> 146 | <td>Operating Voltage (logic level)</td> 147 | <td>5 V</td> 148 | </tr> 149 | <tr> 150 | <td>Input Voltage (recommended)</td> 151 | <td>7-12 V</td> 152 | <tr> 153 | <td>Input Voltage (limits)</td> 154 | <td>6-20 V</td> 155 | <tr> 156 | <td>Digital I/O Pins</td> 157 | <td>14 (of which 6 provide PWM output)</td> 158 | <tr> 159 | <td>Analog Input Pins</td> 160 | <td>8</td> 161 | <tr> 162 | <td>DC Current per I/O Pin</td> 163 | <td>40 mA</td> 164 | </tr> 165 | <tr> 166 | <td>Flash Memory</td> 167 | <td>16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader</td> 168 | </tr> 169 | <tr> 170 | <td>SRAM</td> 171 | <td>1 KB (ATmega168) or 2 KB (ATmega328)</td> 172 | </tr> 173 | <tr> 174 | <td>EEPROM</td> 175 | <td>512 bytes (ATmega168) or 1 KB (ATmega328)</td> 176 | </tr> 177 | <tr> 178 | <td>Clock Speed</td> 179 | <td>16 MHz</td> 180 | </tr> 181 | <tr> 182 | <td>Dimensions</td> 183 | <td>0.73" x 1.70"</td> 184 | </tr> 185 | <tr> 186 | <td>Length</td> 187 | <td>45 mm</td> 188 | </tr> 189 | <tr> 190 | <td>Width</td> 191 | <td>18 mm</td> 192 | </tr> 193 | <tr> 194 | <td>Weigth</td> 195 | <td>5 g</td> 196 | </tr> 197 | </table> 198 | <br><br> 199 | 200 | <b>Power:</b><br> 201 | 202 | The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27).<br> 203 | The power source is automatically selected to the highest voltage source.<br><br> 204 | 205 | <b>Memory:</b><br> 206 | 207 | The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the bootloader); the ATmega328 has 32 KB, (also with 2 KB used for the bootloader).<br> 208 | The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and written with the EEPROM library); the ATmega328 has 2 KB of SRAM and 1 KB of EEPROM.<br><br> 209 | 210 | <b>Input and Output:</b><br> 211 | 212 | Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions.<br> 213 | They operate at 5 volts.<br> 214 | Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions.<br><br> 215 | 216 | <a href="https://www.arduino.cc/en/Main/ArduinoBoardNano">Visit Arduino - ArduinoBoardNano</a> 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | Mini-B 258 | USB 259 | 260 | RESET 261 | BUTTON 262 | >NAME 263 | >VALUE 264 | 265 | 266 | 267 | ICSP 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | <b>Arduino Nano V3.0</b><br><br> 279 | 280 | <b>Overview:</b><br> 281 | 282 | <p>The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.x) or ATmega168 (Arduino Nano 2.x). <br>It has more or less the same functionality of the Arduino Duemilanove, but in a different package.<br> 283 | It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one.<br> 284 | The Nano was designed and is being produced by Gravitech.</p><br> 285 | 286 | <b>Specifications:</b> 287 | <table border="1" style="width:auto"> 288 | <tr> 289 | <td>Microcontroller</td> 290 | <td>Atmel ATmega168 or ATmega328</td> 291 | </tr> 292 | <tr> 293 | <td>Operating Voltage (logic level)</td> 294 | <td>5 V</td> 295 | </tr> 296 | <tr> 297 | <td>Input Voltage (recommended)</td> 298 | <td>7-12 V</td> 299 | <tr> 300 | <td>Input Voltage (limits)</td> 301 | <td>6-20 V</td> 302 | <tr> 303 | <td>Digital I/O Pins</td> 304 | <td>14 (of which 6 provide PWM output)</td> 305 | <tr> 306 | <td>Analog Input Pins</td> 307 | <td>8</td> 308 | <tr> 309 | <td>DC Current per I/O Pin</td> 310 | <td>40 mA</td> 311 | </tr> 312 | <tr> 313 | <td>Flash Memory</td> 314 | <td>16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader</td> 315 | </tr> 316 | <tr> 317 | <td>SRAM</td> 318 | <td>1 KB (ATmega168) or 2 KB (ATmega328)</td> 319 | </tr> 320 | <tr> 321 | <td>EEPROM</td> 322 | <td>512 bytes (ATmega168) or 1 KB (ATmega328)</td> 323 | </tr> 324 | <tr> 325 | <td>Clock Speed</td> 326 | <td>16 MHz</td> 327 | </tr> 328 | <tr> 329 | <td>Dimensions</td> 330 | <td>0.73" x 1.70"</td> 331 | </tr> 332 | <tr> 333 | <td>Length</td> 334 | <td>45 mm</td> 335 | </tr> 336 | <tr> 337 | <td>Width</td> 338 | <td>18 mm</td> 339 | </tr> 340 | <tr> 341 | <td>Weigth</td> 342 | <td>5 g</td> 343 | </tr> 344 | </table> 345 | <br><br> 346 | 347 | <b>Power:</b><br> 348 | 349 | <p>The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27).<br> 350 | The power source is automatically selected to the highest voltage source.</p><br> 351 | 352 | <b>Memory:</b><br> 353 | 354 | <p>The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the bootloader); the ATmega328 has 32 KB, (also with 2 KB used for the bootloader).<br> 355 | The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and written with the EEPROM library); the ATmega328 has 2 KB of SRAM and 1 KB of EEPROM.</p><br> 356 | 357 | <b>Input and Output:</b><br> 358 | 359 | <p>Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions.<br> 360 | They operate at 5 volts.<br> 361 | Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions.</p><br> 362 | 363 | <a href="https://www.arduino.cc/en/Main/ArduinoBoardNano">Visit Arduino - ArduinoBoardNano</a> 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | Since Version 6.2.2 text objects can contain more than one line, 413 | which will not be processed correctly with this version. 414 | 415 | 416 | 417 | -------------------------------------------------------------------------------- /pcb/main.sch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | <b>Arduino Nano V3.0</b><br> 66 | <p>The Nano was designed and is being produced by Gravitech.<br> 67 | 68 | <a href="http://www.gravitech.us/arna30wiatp.html">Gravitech Arduino Nano V3.0</a></p> 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | >NAME 116 | >VALUE 117 | 118 | Reset 119 | 1 120 | Mini-B USB 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | ICSP 132 | 133 | 134 | 135 | 136 | <b>Arduino Nano V3.0</b><br><br> 137 | 138 | <b>Overview:</b><br> 139 | 140 | The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.x) or ATmega168 (Arduino Nano 2.x). It has more or less the same functionality of the Arduino Duemilanove, but in a different package. It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one.<br> 141 | The Nano was designed and is being produced by Gravitech.<br><br> 142 | 143 | <b>Specifications:</b> 144 | <table border="1" style="width:auto"> 145 | <tr> 146 | <td>Microcontroller</td> 147 | <td>Atmel ATmega168 or ATmega328</td> 148 | </tr> 149 | <tr> 150 | <td>Operating Voltage (logic level)</td> 151 | <td>5 V</td> 152 | </tr> 153 | <tr> 154 | <td>Input Voltage (recommended)</td> 155 | <td>7-12 V</td> 156 | <tr> 157 | <td>Input Voltage (limits)</td> 158 | <td>6-20 V</td> 159 | <tr> 160 | <td>Digital I/O Pins</td> 161 | <td>14 (of which 6 provide PWM output)</td> 162 | <tr> 163 | <td>Analog Input Pins</td> 164 | <td>8</td> 165 | <tr> 166 | <td>DC Current per I/O Pin</td> 167 | <td>40 mA</td> 168 | </tr> 169 | <tr> 170 | <td>Flash Memory</td> 171 | <td>16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader</td> 172 | </tr> 173 | <tr> 174 | <td>SRAM</td> 175 | <td>1 KB (ATmega168) or 2 KB (ATmega328)</td> 176 | </tr> 177 | <tr> 178 | <td>EEPROM</td> 179 | <td>512 bytes (ATmega168) or 1 KB (ATmega328)</td> 180 | </tr> 181 | <tr> 182 | <td>Clock Speed</td> 183 | <td>16 MHz</td> 184 | </tr> 185 | <tr> 186 | <td>Dimensions</td> 187 | <td>0.73" x 1.70"</td> 188 | </tr> 189 | <tr> 190 | <td>Length</td> 191 | <td>45 mm</td> 192 | </tr> 193 | <tr> 194 | <td>Width</td> 195 | <td>18 mm</td> 196 | </tr> 197 | <tr> 198 | <td>Weigth</td> 199 | <td>5 g</td> 200 | </tr> 201 | </table> 202 | <br><br> 203 | 204 | <b>Power:</b><br> 205 | 206 | The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27).<br> 207 | The power source is automatically selected to the highest voltage source.<br><br> 208 | 209 | <b>Memory:</b><br> 210 | 211 | The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the bootloader); the ATmega328 has 32 KB, (also with 2 KB used for the bootloader).<br> 212 | The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and written with the EEPROM library); the ATmega328 has 2 KB of SRAM and 1 KB of EEPROM.<br><br> 213 | 214 | <b>Input and Output:</b><br> 215 | 216 | Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions.<br> 217 | They operate at 5 volts.<br> 218 | Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions.<br><br> 219 | 220 | <a href="https://www.arduino.cc/en/Main/ArduinoBoardNano">Visit Arduino - ArduinoBoardNano</a> 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | Mini-B 262 | USB 263 | 264 | RESET 265 | BUTTON 266 | >NAME 267 | >VALUE 268 | 269 | 270 | 271 | ICSP 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | <b>Arduino Nano V3.0</b><br><br> 283 | 284 | <b>Overview:</b><br> 285 | 286 | <p>The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.x) or ATmega168 (Arduino Nano 2.x). <br>It has more or less the same functionality of the Arduino Duemilanove, but in a different package.<br> 287 | It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one.<br> 288 | The Nano was designed and is being produced by Gravitech.</p><br> 289 | 290 | <b>Specifications:</b> 291 | <table border="1" style="width:auto"> 292 | <tr> 293 | <td>Microcontroller</td> 294 | <td>Atmel ATmega168 or ATmega328</td> 295 | </tr> 296 | <tr> 297 | <td>Operating Voltage (logic level)</td> 298 | <td>5 V</td> 299 | </tr> 300 | <tr> 301 | <td>Input Voltage (recommended)</td> 302 | <td>7-12 V</td> 303 | <tr> 304 | <td>Input Voltage (limits)</td> 305 | <td>6-20 V</td> 306 | <tr> 307 | <td>Digital I/O Pins</td> 308 | <td>14 (of which 6 provide PWM output)</td> 309 | <tr> 310 | <td>Analog Input Pins</td> 311 | <td>8</td> 312 | <tr> 313 | <td>DC Current per I/O Pin</td> 314 | <td>40 mA</td> 315 | </tr> 316 | <tr> 317 | <td>Flash Memory</td> 318 | <td>16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader</td> 319 | </tr> 320 | <tr> 321 | <td>SRAM</td> 322 | <td>1 KB (ATmega168) or 2 KB (ATmega328)</td> 323 | </tr> 324 | <tr> 325 | <td>EEPROM</td> 326 | <td>512 bytes (ATmega168) or 1 KB (ATmega328)</td> 327 | </tr> 328 | <tr> 329 | <td>Clock Speed</td> 330 | <td>16 MHz</td> 331 | </tr> 332 | <tr> 333 | <td>Dimensions</td> 334 | <td>0.73" x 1.70"</td> 335 | </tr> 336 | <tr> 337 | <td>Length</td> 338 | <td>45 mm</td> 339 | </tr> 340 | <tr> 341 | <td>Width</td> 342 | <td>18 mm</td> 343 | </tr> 344 | <tr> 345 | <td>Weigth</td> 346 | <td>5 g</td> 347 | </tr> 348 | </table> 349 | <br><br> 350 | 351 | <b>Power:</b><br> 352 | 353 | <p>The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27).<br> 354 | The power source is automatically selected to the highest voltage source.</p><br> 355 | 356 | <b>Memory:</b><br> 357 | 358 | <p>The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the bootloader); the ATmega328 has 32 KB, (also with 2 KB used for the bootloader).<br> 359 | The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and written with the EEPROM library); the ATmega328 has 2 KB of SRAM and 1 KB of EEPROM.</p><br> 360 | 361 | <b>Input and Output:</b><br> 362 | 363 | <p>Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions.<br> 364 | They operate at 5 volts.<br> 365 | Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions.</p><br> 366 | 367 | <a href="https://www.arduino.cc/en/Main/ArduinoBoardNano">Visit Arduino - ArduinoBoardNano</a> 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | PCD8544 with header on the bottom edge 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | Nokia 5110 (PCD5844) display module 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 48 x 84 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | Since Version 6.2.2 text objects can contain more than one line, 513 | which will not be processed correctly with this version. 514 | 515 | 516 | 517 | --------------------------------------------------------------------------------