Q: Do you find yourself after a long weekend asking - "What bugs, defects or enhancements was I working on?" Then building this display and not having to run a query on the web or keeping a sticky note around should help you out.
Project: Display periodic web-based data on an LED display using Java
I needed a relatively quick end-to-end solution where I could display web based data on an external circuit.
The circuit consists of 4 lines of 8 (7-segment LED displays). The display as configured is multiplexed by standard 74HC595 SIPO shift registers - 4 sets of 2 in total for independent column and data line drivers. The microprocessor does not drive the displays directly - it only drives the shift|load|data lines of the 4 sets of shift registers.
The modules of the project are as follows...
- LED display multiplexer (4 lines)
- Microcontroller COMM port tranceiver
- Microcontroller serial to display logic
- PC COMM port tranceiver
- PC HTTP receiver
- PC HTML parser
The first 3 run on the microcontroller that drives the display, we therefore need 4-7 process threads running on the device which include 1-4 display drivers depending on how fast our chip is and if we want independent display lines.
The last 3 modules (hardware comms, http comms and html parser) can all be run from a single SE Java application on the host PC where the device is connected to a USB serial port.
Third Party Software Plugins:
- eclipselink.jar - EclipseLink 2.1.2 ORM implementation of JPA 2.0 API (part of JEE6)
- javax.persistence_2.0.3.v*.jar - The JPA 2.0 API specification interfaces jar
- derbyclient.jar - Derby Java Database 10.5.3.0 client jar
- comm.jar - The SUN Java Communications API jar (for serial/USB port comms)
BOM (Bill of Materials):
- 1 - 40 pin DIP Parallax Propeller PAX32 8-core 32-bit Microcontroller running ASM or SPIN bytecode (with integrated 5MHz crystal, 32Kb EEPROM and FTDI USB controller/jack)
- 8 - 16 pin 74HC595N DIP SIPO shift registers with separate shift/load registers from Parallax, Digikey.ca or futureelectronics.ca
- 16 - blue 7-segment SURE electronics LED digit display
- 16 - red 7-segment SURE electronics LED digit display
- 5 - 63 row breadboards
- 1 - 300-1000mF electrolytic power capacitor
- 1 - 7803 3.3v power transistor with head sink (we get up to 45(c))
- 1 - 7.5 - 9.0v 1A power supply (USB cannot power the board)
- n - 0.1 inch (breadboard compatible) discrete LED from evilmadscience.com - an excellent electronics components distributor
Place the following file in your /src/META-INF/services/javax.persistence.spi.PersistenceProvider file.
Running the code:
- download the SPIN code to the propeller microcontroller
- run the Java client on the Windows/Linux PC
c:\jdk1. 6.0_32bit\bin\java -cp .;javax.persistence_2.0.3.v201010191057.jar;eclipselink.jar;comm.jar;derbyclient.jar org.dataparallel.device.driver.ApplicationService COM15
Pending... along with refactored fault-tolerant code and JPA persistence for DB access.
Added Java JPA 2.0 persistence (PC side) via the EclipseLink 2.1.2 implementation of the spec. The database is currently Derby 10.5.3.0 - which ships with most application servers and the JDK itself.
Update: 20101121: The Propeller controller on this board will be replaced and enhanced with the Spinneret Web Server which contains both the 32-bit Propeller processor and a WIZnet W5100 TCP/IP Ethernet controller - allowing updates to occur over the network instead of via USB.
Also, this board relies on the host PC to gather internet data from a URL - with the Spinneret we can do this all in the embedded device (doing away with the PC alltogether). We will need proxy support though.
Parallax Spinneret product page:
Parallax Spinneret discussion/development forum