├── .gitattributes ├── Pictures ├── Final.jpg ├── Inner_LED_setup.jpg ├── web │ ├── Final_web.jpg │ ├── Inner_LED_setup_web.jpg │ ├── LEDs_on_breadboard_web.jpg │ └── Custom_PCB_with_arduino_web.jpg ├── LEDs_on_breadboard.jpg └── Custom_PCB_with_arduino.jpg ├── Schematic └── Arc reactor.fzz ├── Arc_reactor ├── Config.h ├── Arc_reactor.ino ├── InnerCircle.ino └── OuterCircle.ino ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Pictures/Final.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/Final.jpg -------------------------------------------------------------------------------- /Schematic/Arc reactor.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Schematic/Arc reactor.fzz -------------------------------------------------------------------------------- /Pictures/Inner_LED_setup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/Inner_LED_setup.jpg -------------------------------------------------------------------------------- /Pictures/web/Final_web.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/web/Final_web.jpg -------------------------------------------------------------------------------- /Pictures/LEDs_on_breadboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/LEDs_on_breadboard.jpg -------------------------------------------------------------------------------- /Pictures/Custom_PCB_with_arduino.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/Custom_PCB_with_arduino.jpg -------------------------------------------------------------------------------- /Pictures/web/Inner_LED_setup_web.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/web/Inner_LED_setup_web.jpg -------------------------------------------------------------------------------- /Pictures/web/LEDs_on_breadboard_web.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/web/LEDs_on_breadboard_web.jpg -------------------------------------------------------------------------------- /Pictures/web/Custom_PCB_with_arduino_web.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takacs525/arc-reactor/HEAD/Pictures/web/Custom_PCB_with_arduino_web.jpg -------------------------------------------------------------------------------- /Arc_reactor/Config.h: -------------------------------------------------------------------------------- 1 | 2 | //LEDbar with 74HC595 3 | #define LEDBAR_LATCH_PIN 3 4 | #define LEDBAR_CLOCK_PIN 4 5 | #define LEDBAR_DATA_PIN 2 6 | 7 | #define LEDBAR_BARS 16 8 | 9 | 10 | //Inner circuit leds 11 | #define ILED0_PIN 10 12 | #define ILED1_PIN 6 13 | #define ILED2_PIN 5 14 | #define ILED3_PIN 11 15 | #define ILED4_PIN 9 16 | 17 | 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Peter Takacs 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 | -------------------------------------------------------------------------------- /Arc_reactor/Arc_reactor.ino: -------------------------------------------------------------------------------- 1 | // Global variables 2 | unsigned long Tick = 0; 3 | 4 | 5 | #include "./Config.h" 6 | 7 | void setup() { 8 | Serial.begin(9600); // Initialize serial communications with the PC or bluetooth 9 | 10 | SetupInnerCircle(); 11 | SetupOuterCircle(); 12 | 13 | delay(500); 14 | UpInnerCircle(); 15 | UpOuterCircle(); 16 | 17 | } 18 | 19 | void loop() { 20 | Tick++; 21 | 22 | if (Serial.available()) { 23 | int inByte = Serial.read(); 24 | if (inByte >=49 and inByte <= 52) { 25 | switch (inByte) { 26 | case 49: //1 -> Outer mode + 1 27 | ModeChangeOuter(1); 28 | break; 29 | case 50: //2 -> Outer mode - 1 30 | ModeChangeOuter(-1); 31 | break; 32 | case 51: //3 -> Inner mode - 1 33 | ModeChangeInner(-1); 34 | break; 35 | case 52: //4 -> Inner mode + 1 36 | ModeChangeInner(1); 37 | break; 38 | } 39 | } 40 | } 41 | 42 | LoopInner(); 43 | LoopOuter(); 44 | 45 | delay(10); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to Arc reactor sample 2 | 3 | This Arduino project contains a sample/demo application to drive LEDs in a 3D printed "custom case". 4 | 5 | In motion :-) 6 | ----------------- 7 | [![Youtube video](https://img.youtube.com/vi/b2yPtyNsJaY/0.jpg)](http://www.youtube.com/watch?v=b2yPtyNsJaY) 8 | 9 | Project pictures 10 | ----------------- 11 | ![LEDs_on_breadboard](Pictures/web/LEDs_on_breadboard_web.jpg) | ![Inner_LED_setup](Pictures/web/Inner_LED_setup_web.jpg) 12 | ------------ | ------------- 13 | ![Custom_PCB_with_arduino_web](Pictures/web/Custom_PCB_with_arduino_web.jpg) | ![Final](Pictures/web/Final_web.jpg) 14 | 15 | File structure 16 | ----------------- 17 | Directories: 18 | * Arc_reactor: the Arduino project files 19 | * Pictures 20 | * Schematic: fritzing file folder 21 | 22 | Hardware 23 | ----------------- 24 | Required components: 25 | * an Arduino Pro Mini 5V 26 | * 2 SN74HC595 shift registers 27 | * LEDs 28 | * Resistors (470 ohm) 29 | * a Bluetooth module (HC-07) 30 | 31 | Software 32 | ----------------- 33 | To send mode switch commands (key '1' to '4') you can use the serial monitor in the Arduino IDE or any Bluetooth mobile application (like [Arduino Bluetooth Control](https://play.google.com/store/apps/details?id=com.broxcode.arduinobluetoothfree) in Google Play Store). 34 | 35 | 3D model 36 | ----------------- 37 | Special thanks to Gyorgy Balassy for his incredible work. :clap: 38 | 39 | You can find more informatin on his Thingiverse page: [Tony Stark's Bluetooth Controlled Arc Reactor](http://www.thingiverse.com/thing:2069812) 40 | 41 | -------------------------------------------------------------------------------- /Arc_reactor/InnerCircle.ino: -------------------------------------------------------------------------------- 1 | // Module variables 2 | int InnerPins[] = {ILED0_PIN, ILED1_PIN, ILED2_PIN, ILED3_PIN, ILED4_PIN}; 3 | int InnerMode = 1; //Start mode: all on 4 | 5 | // Mode variables 6 | int IM2_Brightness = 0; // how bright the LED is 7 | int IM2_FadeAmount = 5; // how many points to fade the LED by 8 | 9 | int IM3_Position = 1; // Current LED position 10 | 11 | // Setup 12 | void SetupInnerCircle() { 13 | for (int i = 0; i < 5; i++) { 14 | pinMode(InnerPins[i], OUTPUT); 15 | } 16 | 17 | ResetInnerCircle(); 18 | } 19 | 20 | void ResetInnerCircle() { 21 | for (int i = 0; i < 5; i++) { 22 | digitalWrite(InnerPins[i], LOW); 23 | } 24 | } 25 | 26 | void UpInnerCircle() { 27 | for (int i = 0; i < 5; i++) { 28 | digitalWrite(InnerPins[i], HIGH); 29 | } 30 | } 31 | //------------------------------------------------------------------------------- 32 | 33 | void ModeChangeInner(int change) { 34 | if (change == 1) { 35 | InnerMode = InnerMode + 1; 36 | if (InnerMode > 3) { InnerMode = 3; } 37 | } else { 38 | InnerMode = InnerMode - 1; 39 | if (InnerMode < 0) { InnerMode = 0; } 40 | } 41 | 42 | /* 43 | * Outer modes: 44 | * 0: Off 45 | * 1: On 46 | * 2: Fade 47 | * 3: Circular 48 | */ 49 | switch (InnerMode) { 50 | case 0: 51 | ResetInnerCircle(); 52 | break; 53 | case 1: 54 | UpInnerCircle(); 55 | break; 56 | case 2: 57 | { 58 | IM2_Brightness = 0; // how bright the LED is 59 | IM2_FadeAmount = 5; // how many points to fade the LED by 60 | } 61 | break; 62 | case 3: 63 | { 64 | ResetInnerCircle(); 65 | digitalWrite(ILED0_PIN, HIGH); 66 | digitalWrite(ILED1_PIN, HIGH); 67 | IM3_Position = 1; // Current LED position 68 | } 69 | break; 70 | } 71 | } 72 | 73 | void LoopInner() { 74 | switch (InnerMode) { 75 | case 2: 76 | LoopInnerMode2(); 77 | break; 78 | case 3: 79 | LoopInnerMode3(); 80 | break; 81 | } 82 | } 83 | 84 | void LoopInnerMode2() { 85 | if (Tick % 3 == 0) { 86 | for (int i = 0; i < 5; i++) { 87 | analogWrite(InnerPins[i], IM2_Brightness); 88 | } 89 | 90 | IM2_Brightness = IM2_Brightness + IM2_FadeAmount; 91 | if (IM2_Brightness <= 0 || IM2_Brightness >= 255) { 92 | IM2_FadeAmount = -IM2_FadeAmount; 93 | } 94 | } 95 | } 96 | 97 | void LoopInnerMode3() { 98 | if (Tick % 20 == 0) { 99 | digitalWrite(InnerPins[IM3_Position], LOW); 100 | 101 | IM3_Position++; 102 | if (IM3_Position > 4) { IM3_Position = 1; } 103 | 104 | digitalWrite(InnerPins[IM3_Position], HIGH); 105 | } 106 | } 107 | 108 | -------------------------------------------------------------------------------- /Arc_reactor/OuterCircle.ino: -------------------------------------------------------------------------------- 1 | // Module variables 2 | int OuterMode = 1; //Start mode: all on 3 | 4 | // Mode variables 5 | int OM2_Position = 1; // Current LED position 6 | 7 | int OM3_Position = 1; // Current LED position 8 | byte OM3_Delay = 15; // Current speed 9 | byte OM3_SpeedChange = 1; // Speed up or down 10 | 11 | // Setup 12 | void SetupOuterCircle() { 13 | pinMode(LEDBAR_LATCH_PIN, OUTPUT); 14 | pinMode(LEDBAR_CLOCK_PIN, OUTPUT); 15 | pinMode(LEDBAR_DATA_PIN, OUTPUT); 16 | 17 | ResetOuterCircle(); 18 | } 19 | 20 | void ResetOuterCircle() { 21 | LEDint(0); 22 | } 23 | 24 | void UpOuterCircle() { 25 | LEDbar(10); 26 | } 27 | //------------------------------------------------------------------------------- 28 | 29 | void LEDint(int numberToDisplay) { 30 | digitalWrite(LEDBAR_LATCH_PIN, LOW); 31 | 32 | shiftOut(LEDBAR_DATA_PIN, LEDBAR_CLOCK_PIN, MSBFIRST, (numberToDisplay >> 8)); 33 | shiftOut(LEDBAR_DATA_PIN, LEDBAR_CLOCK_PIN, MSBFIRST, numberToDisplay); 34 | 35 | digitalWrite(LEDBAR_LATCH_PIN, HIGH); 36 | } 37 | 38 | void LEDbar(int bar) { 39 | int numberToDisplay = 0xFFFF >> (LEDBAR_BARS - bar); 40 | 41 | digitalWrite(LEDBAR_LATCH_PIN, LOW); 42 | 43 | shiftOut(LEDBAR_DATA_PIN, LEDBAR_CLOCK_PIN, MSBFIRST, (numberToDisplay >> 8)); 44 | shiftOut(LEDBAR_DATA_PIN, LEDBAR_CLOCK_PIN, MSBFIRST, numberToDisplay); 45 | 46 | digitalWrite(LEDBAR_LATCH_PIN, HIGH); 47 | } 48 | 49 | void ModeChangeOuter(int change) { 50 | if (change == 1) { 51 | OuterMode = OuterMode + 1; 52 | if (OuterMode > 3) { OuterMode = 3; } 53 | } else { 54 | OuterMode = OuterMode - 1; 55 | if (OuterMode < 0) { OuterMode = 0; } 56 | } 57 | 58 | /* 59 | * Outer modes: 60 | * 0: Off 61 | * 1: On 62 | * 2: Circular 63 | * 3: Circular+ 64 | */ 65 | switch (OuterMode) { 66 | case 0: 67 | ResetOuterCircle(); 68 | break; 69 | case 1: 70 | UpOuterCircle(); 71 | break; 72 | case 2: 73 | OM2_Position = 1; // Current LED position 74 | break; 75 | case 3: 76 | { 77 | OM3_Position = 1; // Current LED position 78 | OM3_Delay = 15; // Current speed 79 | OM3_SpeedChange = 1; // Speed change direction 80 | } 81 | break; 82 | } 83 | } 84 | 85 | void LoopOuter() { 86 | switch (OuterMode) { 87 | case 2: 88 | LoopOuterMode2(); 89 | break; 90 | case 3: 91 | LoopOuterMode3(); 92 | break; 93 | } 94 | } 95 | 96 | void LoopOuterMode2() { 97 | if (Tick % 12 == 0) { 98 | LEDint(OM2_Position); 99 | OM2_Position = OM2_Position * 2; 100 | if (OM2_Position > 512) { OM2_Position = 1;} 101 | } 102 | } 103 | 104 | void LoopOuterMode3() { 105 | if (Tick % OM3_Delay == 0) { 106 | LEDint(OM3_Position); 107 | OM3_Position = OM3_Position * 2; 108 | if (OM3_Position > 512) { OM3_Position = 1; } 109 | } 110 | 111 | if (Tick % 200 == 0) { 112 | if (OM3_SpeedChange == 1) { 113 | OM3_Delay--; 114 | if (OM3_Delay == 1 ) { OM3_SpeedChange = -1; } 115 | } else { 116 | OM3_Delay++; 117 | if (OM3_Delay == 15 ) { OM3_SpeedChange = 1; } 118 | } 119 | } 120 | } 121 | 122 | 123 | --------------------------------------------------------------------------------