Project

General

Profile

LAOS I2C Panel v04 » History » Version 3

jaap, 2013-05-07 21:02

1 2 jaap
h1. LAOS I2C Panel v0.4
2 1 jaap
3 1 jaap
{{>toc}}
4 1 jaap
5 3 jaap
!>display-rev0.4.jpg!
6 1 jaap
7 1 jaap
h2. Basics
8 1 jaap
9 1 jaap
We designed a panel with a 2x16 LCD, 4 buttons and a joystick. The heart of the panel is a ATMEGA168-20PU running a small Arduino program. The panel uses I2C communication to the MBED board, but there is also a connection for a standard USB->TTL cable. You can use such a cable to upgrade the program in the Arduino chip.
10 1 jaap
All the source files of this project are available in the i2c panel project on Github: https://github.com/LaosLaser/AddOns
11 1 jaap
12 1 jaap
h2. Functionality
13 1 jaap
14 1 jaap
The user interface functionality is not implemented in this board, but in the program on the MBED. The on board ATMEGA with Arduino code only receives data for displaying on the screen and sends key press codes via I2C, basically this works as a tiny terminal. The functionality as stated here is just to show what the main LaOS controller board uses it for.
15 1 jaap
16 1 jaap
While no job is running:
17 1 jaap
18 1 jaap
* Manual focus, using up and down buttons (for some machines this will mean that the Z-axis is moving, others will move the lens-holder up and down)
19 1 jaap
* Moving the head to a specific location (jog in the X and Y axis)
20 1 jaap
* Select the current location and make that the origin (x=0, y=0, z=0)
21 1 jaap
* Select print job
22 1 jaap
23 1 jaap
While a job is printing:
24 1 jaap
25 1 jaap
* Pause current job
26 1 jaap
* Resume paused job
27 1 jaap
* Cancel current job
28 1 jaap
29 1 jaap
h2. Electronics
30 1 jaap
31 1 jaap
We designed our own board and software (Arduino based) to connect the display board to the mainboard (via I2C interface). The schematics (in KiCAD) are located ["here":https://github.com/LaosLaser/AddOns]. 
32 1 jaap
33 1 jaap
Most important parts:
34 1 jaap
35 1 jaap
"Full part list is available in GIT":https://github.com/LaosLaser/AddOns/raw/master/i2c-panel/pcb/bom.ods
36 1 jaap
37 1 jaap
* 16x2 LCD Display, RS stocknummer 532-6408
38 1 jaap
* ATMega168P-20PU, RS stocknummer 696-2430
39 1 jaap
* 4 Pushbuttons
40 1 jaap
* 1 Joystick button
41 1 jaap
* and of course, the PCB
42 1 jaap
43 1 jaap
!173px-Panel-rev0.3front.jpg!
44 1 jaap
45 1 jaap
h3. Bill of Materials
46 1 jaap
47 1 jaap
|_.Number|_.Component|_.RS Part No.|_.RS Price|_.Farnell Part No.|_.Farnell Price|_.Comment|
48 1 jaap
|1|LCD display, 16x2 characters|532-6408|€ 4,62| | ||
49 1 jaap
|1|ATMega168P-20PU|738-0375|€ 5,22|1636933|€ 4,81||
50 1 jaap
|4|Thru hole tactileswitch12x12x7.3mm|378-6763|€ 0,46| | ||
51 1 jaap
|1|PCB Stick switch, 4 dir + centre push|516-316|€ 2,46|1435775|€ 2,47||
52 1 jaap
|1|Ceramic resonator THT CSTLS 16.00MHz|526-6154|€ 0,56|1448129|€ 0,46||
53 1 jaap
|1|28way low profile DIL socket,0.3in pitch|801-768|€ 0,24| | ||
54 1 jaap
|1|100uF capacitor|711-0703|€ 0,03| | ||
55 1 jaap
|2|100nF capacitor|721-5240|€ 0,07| | ||
56 1 jaap
|1|680R resistor|707-7656|€ 0,02| | ||
57 1 jaap
|1|10K resistor|707-7745|€ 0,02| | ||
58 1 jaap
|1|36 way straight header,7mm top 3mm below|251-8632|€ 0,31| | ||
59 1 jaap
|1|NPN transistor,BC547C|545-2248|€ 0,07| | ||
60 1 jaap
|3|plastic buttoncap black|378-6943|€ 0,11| | ||
61 1 jaap
|1|plastic buttoncap red|378-6937|€ 0,11| | ||
62 1 jaap
|1|Eurocircuits PCB E412106| |€ 7,50| | |Available from LaOS (see "WebShop":http://tuxic.nl/webshop )|
63 1 jaap
64 1 jaap
h2. Mechanical construction
65 1 jaap
66 1 jaap
* PCB is positioned directly under the display
67 1 jaap
* I2C communication is through a 4-pin flatcable with pin-header
68 1 jaap
* A 6-pin (USB->TTL) connector is available for easy updates of the Arduino
69 1 jaap
* 4 standard pushbuttons
70 1 jaap
* 1 Joystick button (with 3D printed key cap)
71 1 jaap
72 1 jaap
The design files for a frontpanel and buttons can be found here: ["Frontplates":https://github.com/LaosLaser/AddOns/tree/master/i2c-panel/frontplates]
73 1 jaap
74 1 jaap
h2. Implementation
75 1 jaap
76 1 jaap
The Arduino software on the ATMEGA chip is "available on github":https://github.com/LaosLaser/AddOns/raw/master/i2c-panel/firmware/lasercutterpanelv0_3.pde.
77 1 jaap
78 1 jaap
The electronics are based on "John Crouchley's ATTiny2313":http://john.crouchley.com/blog/archives/612 implementation. The Arduino (or Ottantotto) electronics come from "Edwin Dertien":http://wiki.edwindertien.nl/doku.php?id=boards:ottantotto:start#pin_description.
79 1 jaap
80 1 jaap
Relevant Arduino libraries:
81 1 jaap
82 1 jaap
* LCD driver: "http://www.arduino.cc/en/Reference/LiquidCrystal":http://www.arduino.cc/en/Reference/LiquidCrystal
83 1 jaap
* i2c: "http://www.arduino.cc/en/Reference/Wire":http://www.arduino.cc/en/Reference/Wire
84 1 jaap
* Keypad: "http://www.arduino.cc/playground/Code/Keypad":http://www.arduino.cc/playground/Code/Keypad
85 1 jaap
86 1 jaap
I2C on the Mbed: "http://mbed.org/handbook/I2C":http://mbed.org/handbook/I2C <em>"Have a look at this very enlightning drawing!":http://mbed.org/media/uploads/ColonelPewter/i2c_001004.gif</em>
87 1 jaap
88 1 jaap
For debugging, you can use any PC with a home-made I2C adapter:
89 1 jaap
90 1 jaap
p(((. http://www.instructables.com/id/Worlds-Cheapest-I2C-I-Squared-C-Adapter/
91 1 jaap
http://www.paintyourdragon.com/?p=43
92 1 jaap
93 1 jaap
94 1 jaap
h2. Building your own
95 1 jaap
96 1 jaap
To make life easier, we sell premade PCB's and this panel as a kit. See the "WebShop":http://tuxic.nl/webshop.
97 1 jaap
98 1 jaap
The kit contains:
99 1 jaap
100 1 jaap
* PCB
101 1 jaap
* ATMEGA168-20PU, pre-programmed with the Arduino bootloader and this I2C program (so you can install it even if you do not own a USB-&gt;TTL cable).
102 1 jaap
* LCD
103 1 jaap
* other electronic parts
104 1 jaap
* Buttons
105 1 jaap
* I2C wire to motherboard
106 1 jaap
107 1 jaap
Parts it does not contain:
108 1 jaap
109 1 jaap
* Laser cut panel. You can make one on your laser, maybe? Probably you want one to fit into your machine, anyway. See below for the panel the MiniFabLab made for its HPC LS3020
110 1 jaap
* 3D Printed joystick button. When I design one I'm really proud of, I might include it.
111 1 jaap
112 1 jaap
Feel free to make the user interface panel yourself if you prefer. No need to buy stuff if you have an Arduino lying around with LCD and some buttons!
113 1 jaap
114 1 jaap
h2. Soldering
115 1 jaap
116 1 jaap
* Solder the socket for the Atmel IC first, making sure the notch is on the same side as the one on the silkscreen legend.
117 1 jaap
* Place the two resistors. The print says 680 (Ohm) for R1. Put the other one of 10k Ohm in the place marked R2.
118 1 jaap
* Solder the two 100nF capacitors
119 1 jaap
* Solder the 100uF electrolytic capacitor with the plus (longer) wire in the hole with square solder pad
120 1 jaap
* Bend the wires of the BC547C so it lies flat on the print and solder in place
121 1 jaap
* Solder the 3 pin ceramic resonator
122 1 jaap
* Place a 2-pin header in P7, a 4-pin header for I2C and a 6-pin header in P1 (TTL).
123 1 jaap
* Now take a 16-pin header and push it with the longer pin ends in the PCB from the bottom (solder) side of the board. The long pins will stick out on the top side of the board. The black plastic of the header in now on the bottom of the PCB. Measure with the display module to see if the pins are long enough to go just through the module. Solder the 16-pin header to the board on the TOP (component) side.
124 1 jaap
* Place a strong piece of tape on the bottom side of the board, covering the part of the board that will be under the display module, so that there cannot be any shortcircuit between the board and the display module. You can use electric shielding tape or gaffer tape.
125 1 jaap
* Solder the display module on the back side board, with the black strip of the 16-pin header in between.
126 1 jaap
* Solder the 4 buttons to the board (not the joystick yet!) with the buttons on the side of the display (solder side). This is confusing: the buttons go on the side where it does NOT say button! See photos.
127 1 jaap
* The joystick has a very small dent in the top metal layer. If you put the joystick in, this dent should be on the right side. Solder it in.
128 1 jaap
* The holes you have left are for making wire-bridges on a single sided board. You don't need them.
129 1 jaap
130 1 jaap
Back panel
131 1 jaap
!I2CPanelBack-rev0.3.JPG!
132 1 jaap
133 1 jaap
Front Panel showing dent in joystick
134 1 jaap
!I2CPanelFront-rev0.3.JPG!
135 1 jaap
136 1 jaap
Showing connection on the I2C Panel side
137 1 jaap
!I2CPanelBankConnector-rev0.3.JPG!
138 1 jaap
139 1 jaap
Showing connection on the Main Board side
140 1 jaap
!IC2PanelConnectedToMainBoard-rev0.3.jpg!
141 1 jaap
 
142 1 jaap
143 1 jaap
h2. Software installation
144 1 jaap
145 1 jaap
h3. Installing a bootloader
146 1 jaap
147 1 jaap
These instructions are for ATMEGA168P-PU only!
148 1 jaap
149 1 jaap
    cd arduino-1.0.1/hardware/arduino/bootloaders/atmega
150 1 jaap
avrdude -p m168p -c usbasp -F -U flash:w:ATmegaBOOT_168_diecimila.hex -U hfuse:w:0xdd:m -U lfuse:w:0xff:m -U efuse:w:0xf8:m
151 1 jaap
152 1 jaap
153 1 jaap
Note that the Debian version of avrdude does not support m168p yet, you can use the avrdude version shipped with Arduino.
154 1 jaap
155 1 jaap
Error message while installing:
156 1 jaap
157 1 jaap
    avrdude: safemode: efuse changed! Was f8, and is now 0
158 1 jaap
Would you like this fuse to be changed back? [y/n]
159 1 jaap
160 1 jaap
161 1 jaap
Answer n !
162 1 jaap
163 1 jaap
h3. Arduino Sketch
164 1 jaap
165 1 jaap
Use a USB=&gt;TTL cable to connect the board to your computer. Install "Arduino":http://www.arduino.cc software. Get "lasercutterpanelv0&#95;3.pde from GIT": https://github.com/LaosLaser/AddOns/raw/master/i2c-panel/firmware/lasercutterpanelv0_3.pde
166 1 jaap
167 1 jaap
To test your panel, change:
168 1 jaap
169 1 jaap
    #define DEBUG 0 
170 1 jaap
171 1 jaap
172 1 jaap
to
173 1 jaap
174 1 jaap
    #define DEBUG 1
175 1 jaap
176 1 jaap
177 1 jaap
Arduino settings: Board: Arduino NG or older with Atmega168
178 1 jaap
179 1 jaap
Upload the file to the board. This will give you a welcome text. After the text has disappeared, all buttons should show a number on the screen. The joystick should show 5 different values for each direction and middle push.
180 1 jaap
181 1 jaap
If it works, upload the code again with *DEBUG 0*. The panel is now ready to be connected to the mainboard.
182 1 jaap
183 1 jaap
h2. Control Panel on the HPC LS3020
184 1 jaap
185 1 jaap
186 1 jaap
To accomodate the display you can cut a replacement for the control panel. 
187 1 jaap
188 1 jaap
!greenpanel-bart.jpg!
189 1 jaap
190 1 jaap
The button laser switch was replaced by a toggle for better on/off reference. So the right serial test button could be omitted. Also the lighting switch was removed, now the light is always on. No modifications are required for the cabletree, just connect the wires from the removed switches. The air pump switch was kept as a compressor can be noisy. It is advised to use a shielded cable between the I2C panel and the board. A cutting file (.svg) of this panel is available on "miniFabLab":http://minifablab.nl/uploads/LaOS3020panel.svg.
191 1 jaap
192 1 jaap
h2. Design competition
193 1 jaap
194 1 jaap
I couldn't find a fitting existing joystick button for the joystick in this design, so I made one on the 3D printer. But I'm not entirely happy with it yet. If you design a better one, please upload it here!
195 1 jaap
196 1 jaap
h2. Enhancements
197 1 jaap
198 1 jaap
Possible enhancements to the display:
199 1 jaap
200 1 jaap
* Make (I2C) connector holes slightly larger to be able to mount JST connector (also, some more clearance to micro controller is required)
201 1 jaap
* Larger holes also for USB-&gt;TTL cable, display and switches
202 1 jaap
* Move capacitor U4 to a safer place, near micro controller
203 1 jaap
* Holes for R2 are too big and texts for resistors are strange
204 1 jaap
* Mark clearly on the board that the buttons go on the back side!
205 1 jaap
* Add status LED(s)
206 1 jaap
* Buzzer?
207 1 jaap
* Rotary encoder for (power) settings
208 1 jaap
* Graphical touch-screen display?
209 1 jaap
210 1 jaap
h2. More
211 1 jaap
212 1 jaap
For links on previous versions and to get started on designing your own display, see the [[Display-alternatives]] page.