Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xxx #2

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="libs/RXTXcomm.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright Tomas Uktveris (c) 2015

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 45 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
DotMatrixJava
=============
8x8x8 Led Cube control program
---------

Java PC animation generator for 3D8S 8x8x8 Led charlieplexed
PC control program for generic 8x8x8 3D LED Cube found on eBay
(e.g. 3D LightSquared 8x8x8 LED Cube DIY kit, ideasoft, etc.)

![Program view](/help/program_view.png)

* Written in Java (requires Java RE, download here: http://java.com)
* Supports direct animation playback through Serial/UART interface (rxtx library)
* Various GUI usability enhancements

##### Firmware
This program can control any packet format compatible LED cube (see below).
Example firmware of a compatible LED cube with an STC12C5A60S2 MCU can be found here: [Source Code](https://github.com/tomazas/ledcube8x8x8)

##### Using the program
* Run run_x32.bat for 32-bit Windows
* Run run_x64.bat for 64-bit Windows

Check this YouTube video for example: https://youtu.be/UplJi7pdV_Y
[![Using program](http://img.youtube.com/vi/UplJi7pdV_Y/0.jpg)](https://youtu.be/UplJi7pdV_Y)

##### LED Cube control packet format

8x8x8 LED Cubes that support below packet format can be controlled with the program via Serial console or other MCU such as an Atmega/Arduino.
Example UART/Serial packet (in hex):
```
F2
00 00 00 00 00 00 00 FF
00 00 00 00 00 00 00 FF
00 00 00 00 00 00 00 FF
00 00 00 00 00 00 00 FF
00 00 00 00 00 00 00 FF
00 00 00 00 00 00 00 FF
00 00 00 00 00 00 00 FF
00 00 00 00 00 00 00 FF
```

* F2 - denotes packet header (aka. batch update)
* next 64 bytes - (8x8x8 bits) of LED light states
* one byte - controls a LED row (8 LEDs)
* can be any value in range: 00-FF (i.e. 00 - all 8 LEDs in row are off, FF - all 8 LEDs are on)
* a single line (e.g. 00 00 00 00 00 00 00 FF) denotes a 64 LED layer

`Implementation note:` to save energy/current consumption only a single layer (64 LEDs) in a LED cube is ON at one time. This is done for all layers and so fast (using a hardware timer), that the human eye does not recognize this. This hack allows to view the cube (all layers) as fully lit.
24 changes: 6 additions & 18 deletions arduino-controller/SDAnimation.ino
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
#include "SD.h"
#include "string.h"

Sd2Card card;
SdVolume volume;
const int chipSelect = 4;
File root;

void setup()
{
Serial.begin(57600);
Serial.begin(9600);

pinMode(10, OUTPUT); // change this to 53 on a mega
pinMode(10, OUTPUT); // SS pin must be output, change this to 53 on a mega

bool sd_ok = SD.begin(9);
bool sd_ok = SD.begin(9); // chip select pin

if (!sd_ok)
{
Expand All @@ -25,22 +22,13 @@ void setup()

void sendAnimation(byte *data)
{
Serial.write(0xf3);
Serial.write(data[1]);

Serial.write(0xf4);
Serial.write(data[2]);

Serial.write(0xf5);
Serial.write(data[3]);

Serial.write(0xf2);
Serial.write(0xf2); // batch update supported
for (byte i = 8; i < 72; i++)
{
Serial.write(data[i]);
}

delay(makeWord(data[6], data[7]));
delay(20);
}

void readAnimation(File & file)
Expand All @@ -61,7 +49,7 @@ void loop(void)
char *p = file.name();
char *p_dot = strchr(p, '.');

if (p_dot != NULL && strcmp(p_dot, ".DAT") == 0)
if (p_dot != NULL && strcmp(p_dot, ".dat") == 0)
{
readAnimation(file);
}
Expand Down
Binary file modified dotmatrixjava.jar
Binary file not shown.
Binary file removed examples.zip
Binary file not shown.
Binary file added help/program_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added libs/RXTXcomm.jar
Binary file not shown.
Binary file removed record.dat
Binary file not shown.
Binary file removed record2.dat
Binary file not shown.
Binary file removed record3.dat
Binary file not shown.
1 change: 1 addition & 0 deletions run_x32.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -Djava.library.path=./runtime/x32 -jar dotmatrixjava.jar
1 change: 1 addition & 0 deletions run_x64.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -Djava.library.path=./runtime/x64 -jar dotmatrixjava.jar
Binary file added runtime/x32/rxtxParallel.dll
Binary file not shown.
Binary file added runtime/x32/rxtxSerial.dll
Binary file not shown.
Binary file added runtime/x64/rxtxParallel.dll
Binary file not shown.
Binary file added runtime/x64/rxtxSerial.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions src/aguegu/dotmatrix/DMRecordFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ public byte[] getData() {

return data;
}

public byte[] getSimpleData() {
byte[] data = new byte[65];

data[0] = (byte) 0xf2;
System.arraycopy(dm.getCache(), 0, data, 1, DotMatrix.CACHE_LENGTH);

return data;
}

public String getCacheString() {
return DotMatrix.cacheString(getData());
Expand Down
Loading