|
| 1 | +# PixelTeleporter |
| 2 | +- **Display:** View the output from your hardware LED controller as virtual 3D pixels on a computer monitor. |
| 3 | +- **Prototype:** Build a virtual version of your next LED project so you can have software written and debugged before you build |
| 4 | +the physical display. |
| 5 | +- **Evaluate:** Test, tune and update your pattern software at your bench, away from the hardware installation. |
| 6 | + |
| 7 | +This version of PixelTeleporter works exclusively with the [Pixelblaze controller](https://www.bhencke.com/pixelblaze). |
| 8 | + |
| 9 | +## Ok, but what *exactly* is PixelTeleporter? |
| 10 | +PixelTeleporter is a software toolkit - a set of server programs for various platforms, and a library for the Processing 3 environment. It lets you |
| 11 | +connect the output of your LED controller to a server device in place of an LED strip/panel/whatever. |
| 12 | + |
| 13 | +The server then forwards the pixel data across your LAN to the computer running Processing and displays your LED output. |
| 14 | + |
| 15 | +The Processing library make it simple to write sketches to receive the data and draw the pixels in 3D on your computer. |
| 16 | +With this toolset and the included examples, you can quickly prototype almost any physical arrangement of LEDs. |
| 17 | + |
| 18 | +## Version 1.1.1 (10/21/2020) What's New |
| 19 | +Support for multiple Pixelblazes. (See new DualMatrix example) |
| 20 | +Added Fermat Spiral (Fibonacci256) example. |
| 21 | +BETA: You can now use the "l" key while your sketch is running to toggle the display of wiring labels -- the index of each pixel. |
| 22 | + |
| 23 | +## Version 1.1.0 (10/08/2020) What's New |
| 24 | +**Support for Raspberry Pi and FTDI USB-to-Serial boards on Linux & Windows** |
| 25 | + |
| 26 | +You can now hook your Pixelblaze directly to your Raspberry Pi's serial input, or to your |
| 27 | +Linux or Windows 10 computer through an FTDI USB-to-Serial converter. |
| 28 | + |
| 29 | +The new server software, pbxTeleporter, uses very little CPU,so you can hook up your Pixelblaze and run your PixelTeleporter scripts |
| 30 | +on the same machine! Both wired and wireless networks are supported, and the servers support sending data to multiple clients. |
| 31 | + |
| 32 | +To use the new features, you will need to reinstall the Processing library. (You should also update your ESP8266 firmware, just to stay current.) |
| 33 | + |
| 34 | +A a small change to the PixelTeleporter object creation API was necessary. When you create a PixelTeleporter object, you must now specify two port numbers: |
| 35 | +- **serverPort** (default 8081) - the port number that the server software uses to listen for commands |
| 36 | +- **clientPort** ( default 8082) - the port that the Processing script receives data on. |
| 37 | + |
| 38 | +To simplify things, you can now create a PixelTeleporter object without specifying ports. The defaults ports will be used. The examples are all set up this way now. |
| 39 | + |
| 40 | +Existing scripts will not break. If you use the old constructor to specify only one port number, it is used for both client and server. |
| 41 | +But you will not be able to have script and Pixelblaze on the same machine without adjusting your scripts. |
| 42 | + |
| 43 | +## Version 1.0.0 (9/24/2020) |
| 44 | +**PixelTeleporter is now a Processing library!** |
| 45 | +See the new installation and usage instructions below. Being a library makes many things easier going forward. |
| 46 | +Your sketch code will require a lot less boilerplate, the examples are easily accessible through the Processing UI, |
| 47 | +and it will be way, way easier to add and improve features without breaking anybody's scripts. |
| 48 | + |
| 49 | +This time though, exisiting scripts will need minor changes to work with the library version -- see the examples |
| 50 | +and the [Javadoc](https://zranger1.github.io/PixelTeleporter/pixelTeleporter/library/package-summary.html) for details. |
| 51 | +The "old" version of PixelTeleporter is still available on the "archive" branch of the [git repository](https://github.com/zranger1/PixelTeleporter). |
| 52 | + |
| 53 | +## Version 0.0.2 (9/7/2020) |
| 54 | +Added Pixelblaze pixel map import export. This let you build a displayable object directly from a |
| 55 | +Pixelblaze compatible json map. See the new **MapIO** example for more information. |
| 56 | + |
| 57 | +Also... minor bug fixes in viewport management and ongoing cosmetic touchup of examples. |
| 58 | + |
| 59 | +## Requirements |
| 60 | +A **server device**. These are the currently supported server platforms: |
| 61 | +- **[Raspberry Pi](./servers/Pi)** For Raspberry Pi, running Raspbian or other Linux |
| 62 | +- **[Linux](./servers/Linux)**, For most common Linux distros -- tested on Debian 10 and Ubuntu 18.04. |
| 63 | +- **[Windows](./servers/Windows)** For Windows 7 - 10. |
| 64 | +- **[ESP8266 microcontroller](./servers/ESP8266)** - I used a NodeMCU 1.0 board for development, but there are many suitable boards. |
| 65 | + |
| 66 | +**An FTDI USB->Serial adapter** - you'll need one of these for the Linux and Windows servers. (I highly recommend adding one to your toolbox in any case |
| 67 | +if you don't own one already. Inexpensive and useful for any number of programming and debugging tasks.) |
| 68 | + |
| 69 | +**[Processing 3](https://www.processing.org/download/)** - Processing is a very easy to use Java based graphics and prototyping environment. If you |
| 70 | +haven't used it before, you're in for a treat. |
| 71 | + |
| 72 | +Basic familiarity with the hardware and a little coding skill are helpful. But if you're new to this, no worries. |
| 73 | +Setup is pretty by-the-numbers, and there's really nothing better than the instant feedback of the Pixelblaze/Processing combo |
| 74 | +to help you quickly improve your coding and graphics skills. |
| 75 | + |
| 76 | +You'll also need a computer with reasonably modern OpenGL compatible graphics hardware, running any OS that Processing 3 supports. Faster is better. |
| 77 | + |
| 78 | +## Installing the Library into Processing |
| 79 | +To install, you will need to [download PixelTeleporter.zip](https://github.com/zranger1/PixelTeleporter/releases/tag/1.1.0) and |
| 80 | +manually copy it to the ```libraries``` folder of your Processing sketchbook. |
| 81 | + |
| 82 | +To find the Processing sketchbook on your computer, open the Preferences window from the Processing application (PDE) and look |
| 83 | +for the "Sketchbook location" item at the top. |
| 84 | + |
| 85 | +By default the following locations are used for your sketchbook folder: |
| 86 | + * For Mac users, the sketchbook folder is located in `~/Documents/Processing` |
| 87 | + * For Windows users, the sketchbook folder is located in `My Documents/Processing` |
| 88 | + |
| 89 | +Download the latest release - [PixelTeleporter.zip](https://github.com/zranger1/PixelTeleporter/releases/tag/1.1.0) from this repository. |
| 90 | + |
| 91 | +Unzip and copy the PixelTeleporter folder into the `libraries` folder in the Processing sketchbook. |
| 92 | +If `libraries` does not exist, (this is unlikely, but possible) you will need to create it. |
| 93 | + |
| 94 | +The folder structure should look like when you're done: |
| 95 | + |
| 96 | +``` |
| 97 | +Processing |
| 98 | + libraries |
| 99 | + PixelTeleporter |
| 100 | + examples |
| 101 | + library |
| 102 | + PixelTeleporter.jar |
| 103 | + reference |
| 104 | + src |
| 105 | +``` |
| 106 | + |
| 107 | +After installing PixelTeleporter, restart Processing. |
| 108 | + |
| 109 | +## Connecting your Pixelblaze |
| 110 | +See the README.md file in the servers directory for information on how to set up a device as |
| 111 | +a PixelTeleporter server (pbxTeleporter) and connect it to your Pixelblaze. |
| 112 | + |
| 113 | +Source code and project files for the various server versions lives in its own repository at: |
| 114 | + |
| 115 | +https://github.com/zranger1/pbxTeleporterServers |
| 116 | + |
| 117 | +# Programming with PixelTeleporter: An Introduction |
| 118 | +PixelTeleporter is designed to get you up and displaying pixels with as little code overhead |
| 119 | +as possible. See the examples for complete implementations and handy tools. To use PixelTeleporter in |
| 120 | +a sketch first, include the library. (Typically, you'll need to include java.util as well.) |
| 121 | + |
| 122 | +``` |
| 123 | +import pixelTeleporter.library.*; |
| 124 | +import java.util.*; |
| 125 | +``` |
| 126 | + |
| 127 | +Next, you'll need to create a PixelTeleporter object and set up a list of pixels with which to build |
| 128 | +your LED object. Like this: |
| 129 | + |
| 130 | +``` |
| 131 | + PixelTeleporter pt; |
| 132 | + LinkedList<ScreenLED> panel; |
| 133 | +``` |
| 134 | + |
| 135 | +In your sketch's setup() function, initialize your objects (using your own PixelTeleporter |
| 136 | +transmitter's IP address, of course). |
| 137 | + |
| 138 | +``` |
| 139 | + void setup() { |
| 140 | + size(1000,1000,P3D); // Set up the Processing window. |
| 141 | + |
| 142 | +// initialize PixelTeleporter object |
| 143 | + pt = new PixelTeleporter("192.168.1.42",8081); |
| 144 | + pt.setElementSize(20); // set display size of virtual LEDs |
| 145 | + |
| 146 | + pt.start(); // start the network thread. Request and listen for frames. |
| 147 | +``` |
| 148 | +Now, you can build your own LED object. This is actually the fun, interesting part. It amounts to writing |
| 149 | +code to determine where each LED will be in 3D space, calling `pt.ScreenLEDFactory()` to create the LED, and |
| 150 | +adding the LED to the LinkedList you created earlier. See the examples for details on exactly how to do this. |
| 151 | + |
| 152 | +``` |
| 153 | +// build an LED object |
| 154 | + panel = buildAnInterestingLEDObject(); // left as an exercise for reader! |
| 155 | + } |
| 156 | +``` |
| 157 | + |
| 158 | +Now, you're done with setup. PixelTeleporter allows your draw function to be very simple. |
| 159 | + |
| 160 | +``` |
| 161 | + void draw() { |
| 162 | + background(30); // fill background with dark grey |
| 163 | +
|
| 164 | + // render your LED object |
| 165 | + pt.render3D(panel); |
| 166 | + } |
| 167 | +``` |
| 168 | + |
| 169 | +That's it! All you need for a basic PixelTeleporter sketch. See the examples for |
| 170 | +complete, working sketches, and the [Javadocs](https://zranger1.github.io/PixelTeleporter/pixelTeleporter/library/package-summary.html) in |
| 171 | +the [git repository](https://github.com/zranger1/PixelTeleporter) (or in reference subdir of your installation directory) |
| 172 | +for more technical information. |
| 173 | + |
| 174 | +## Examples |
| 175 | +After installation, examples can be accessed through the File/Examples menu item in the main Processing window. |
| 176 | +Click on "PixelTeleporter" in the "Java Examples" dialog to see a list of available examples. To load example, |
| 177 | +double click on it. To run it, replace the IP address in setup() with your own, check that your LED controller |
| 178 | +is configured correctly and press Processing's "Run" button. |
| 179 | + |
| 180 | +The following controls are available in all examples: |
| 181 | +- mouse wheel: zoom in and out |
| 182 | +- mouse left drag: rotate object. |
| 183 | +- space bar: Stop/start automatic rotation, if any |
| 184 | +- 'r' key: Reset rotation. |
| 185 | + |
| 186 | +The included examples are: |
| 187 | +### Matrix |
| 188 | +All 2048 pixels in a 32x64 matrix. Use with the default Pixelblaze matrix mapper. |
| 189 | +(Be sure to set width in the mapping function and comment out any line that |
| 190 | +references zigzag wiring.) |
| 191 | + |
| 192 | +### Ring |
| 193 | +Simulated LED ring. Adjustable radius and start and stop angles. The Pixelblaze |
| 194 | +ring mapper is optional. |
| 195 | + |
| 196 | +### Fermat Spiral |
| 197 | +256 pixels arranged in a Fermat spiral (Fibonacci256) pattern. Does not |
| 198 | +require a mapper to make 1D patterns do very interesting things. |
| 199 | + |
| 200 | +### Walled Cube |
| 201 | +600 pixel (10x10) walled cube. Use with the walled cube mapping function from |
| 202 | +the example's PixelMap tab or from the repository's |
| 203 | +[MappingFunctions](https://github.com/zranger1/PixelTeleporter/tree/master/PixelTeleporter/examples/MappingFunctions) . |
| 204 | + |
| 205 | +### Volumetric Cube |
| 206 | +1000 pixel (10x10x10) volumetric cube. Use with either this |
| 207 | +mapping function in the example's PixelMap tab or with the default Pixelblaze mapper. |
| 208 | +(If you use the Pixelblaze's mapper, be sure that any line that |
| 209 | +references zigzag wiring is commented out.) |
| 210 | + |
| 211 | +### Cylinder |
| 212 | +Wraps a 2D panel around a cylinder (Or you can think of it as a |
| 213 | +stack of rings.) Use the Pixelblaze matrix mapper. Alternately, |
| 214 | +you can configure the cylinder as a spiral and just run it |
| 215 | +1D. See the example code for details. |
| 216 | + |
| 217 | +### Sphere |
| 218 | +Maps LEDs evenly over the surface of a sphere. To use the sphere as a 2D surface, use the sphere mapper |
| 219 | +in the example's PixelMap tab or the repository's |
| 220 | +[MappingFunctions](https://github.com/zranger1/PixelTeleporter/tree/master/PixelTeleporter/examples/MappingFunctions) . |
| 221 | + |
| 222 | +### Fireworks2020 |
| 223 | +Emulation of JeffV's Fireworks2020 setup from the Pixelblaze forums. See the video |
| 224 | +of his actual setup at https://youtu.be/zgF3DJoTAWI. The pattern is available under |
| 225 | +the topic "Fireworks for the 4th" in the Pixelblaze forums. |
| 226 | + |
| 227 | +### MapIO |
| 228 | +Reads a Pixelblaze JSON pixel map (in this case, the walled cube) from a file and |
| 229 | +uses it to build a displayable object. You can get these maps by running your |
| 230 | +Pixelblaze mapping function in a Javascript interpreter and capturing the output, |
| 231 | +or as I did, you can use your browser's debug console to capture the map directly |
| 232 | +from the Pixelblaze web UI by temporarily adding `console.debug(map)` to the mapping function |
| 233 | +right before it returns the map. |
| 234 | + |
| 235 | +# Building the PixelTeleporter Library |
| 236 | +The Processing library portion of PixelTeleporter is built using the Eclipse IDE for Java, version 2019-6. To build it, clone the |
| 237 | +[repository](https://github.com/zranger1/PixelTeleporter) ,and import it as an Eclipse project. Check that |
| 238 | + the build and library settings in Eclipse work on your machine, |
| 239 | +build the project and go! |
| 240 | + |
| 241 | + |
| 242 | + |
0 commit comments