Project

General

Profile

LAOS I2C Panel v04 » History » Version 22

jaap, 2016-03-15 11:13

1 2 jaap
h1. LAOS I2C Panel v0.4
2 1 jaap
3
{{>toc}}
4
5 3 jaap
!>display-rev0.4.jpg!
6 1 jaap
7
h2. Basics
8
9
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
All the source files of this project are available in the i2c panel project on Github: https://github.com/LaosLaser/AddOns
11
12
h2. Functionality
13
14
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
16
While no job is running:
17
18
* 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
* Moving the head to a specific location (jog in the X and Y axis)
20
* Select the current location and make that the origin (x=0, y=0, z=0)
21
* Select print job
22
23
While a job is printing:
24
25
* Pause current job
26
* Resume paused job
27
* Cancel current job
28
29
h2. Electronics
30
31
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
33
Most important parts:
34
35 5 jaap
"Full part list is available in GIT":https://github.com/LaosLaser/AddOns/blob/master/i2c-panel/pcb-0.4/bom.ods
36 1 jaap
37
* 16x2 LCD Display, RS stocknummer 532-6408
38
* ATMega168P-20PU, RS stocknummer 696-2430
39
* 4 Pushbuttons
40
* 1 Joystick button
41
* and of course, the PCB
42
43
!173px-Panel-rev0.3front.jpg!
44
45
h3. Bill of Materials
46
47
|_.Number|_.Component|_.RS Part No.|_.RS Price|_.Farnell Part No.|_.Farnell Price|_.Comment|
48 12 jaap
|1|LCD display, 16x2 characters|532-6408 / 720-0207|€ 5,50| | ||
49 1 jaap
|1|ATMega168P-20PU|738-0375|€ 5,22|1636933|€ 4,81||
50 14 jaap
|1|ATMega328P-20PU|-|-|-|-|either 168 or 328, not both|
51 1 jaap
|4|Thru hole tactileswitch12x12x7.3mm|378-6763|€ 0,46| | ||
52
|1|PCB Stick switch, 4 dir + centre push|516-316|€ 2,46|1435775|€ 2,47||
53
|1|Ceramic resonator THT CSTLS 16.00MHz|526-6154|€ 0,56|1448129|€ 0,46||
54
|1|28way low profile DIL socket,0.3in pitch|801-768|€ 0,24| | ||
55
|1|100uF capacitor|711-0703|€ 0,03| | ||
56
|2|100nF capacitor|721-5240|€ 0,07| | ||
57
|1|10K resistor|707-7745|€ 0,02| | ||
58 12 jaap
|1|36 way straight header,7mm top 3mm below|251-8632|€ 1,034|1824426|€ 0,92||
59 6 jaap
|2|BS270|| 1017689|€ 0,15||
60
|1|Kingstate KPEG242 buzzer| | |1502726|€ 2,03| |
61 1 jaap
|3|plastic buttoncap black|378-6943|€ 0,11| | ||
62
|1|plastic buttoncap red|378-6937|€ 0,11| | ||
63 22 jaap
|1|JST 4 pin PCB connector B4B-XH-A (LF)(SN)|543-2733|€ 0,16|1516278|€ 0,20|I2C (optional)|
64 16 jaap
|1|lasercut cardboard||||||
65 6 jaap
|1|PCB E218213| |€ 7,50| | |Available from LaOS (see "WebShop":http://tuxic.nl/webshop )|
66 1 jaap
67
h2. Mechanical construction
68
69
* PCB is positioned directly under the display
70
* I2C communication is through a 4-pin flatcable with pin-header
71
* A 6-pin (USB->TTL) connector is available for easy updates of the Arduino
72
* 4 standard pushbuttons
73
* 1 Joystick button (with 3D printed key cap)
74
75
The design files for a frontpanel and buttons can be found here: ["Frontplates":https://github.com/LaosLaser/AddOns/tree/master/i2c-panel/frontplates]
76 10 jaap
Peter Uitenhoven posted a Joystick thumb on Thingiverse: http://www.thingiverse.com/thing:87346
77 21 jaap
Mowi designed a Joystick knob: https://www.youmagine.com/designs/joystick-knob-for-laos-laser
78 1 jaap
79
h2. Implementation
80
81 9 jaap
The Arduino software on the ATMEGA chip is "available on github":https://github.com/LaosLaser/AddOns/raw/master/i2c-panel/firmware/lasercutterpanelv0_4.ino
82 1 jaap
83
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.
84
85
Relevant Arduino libraries:
86
87
* LCD driver: "http://www.arduino.cc/en/Reference/LiquidCrystal":http://www.arduino.cc/en/Reference/LiquidCrystal
88
* i2c: "http://www.arduino.cc/en/Reference/Wire":http://www.arduino.cc/en/Reference/Wire
89
* Keypad: "http://www.arduino.cc/playground/Code/Keypad":http://www.arduino.cc/playground/Code/Keypad
90
91 11 peteruithoven
I2C on the Mbed: "http://mbed.org/handbook/I2C":http://mbed.org/handbook/I2C "Have a look at this very enlightning drawing!":http://mbed.org/media/uploads/ColonelPewter/i2c_001004.gif
92 1 jaap
93
For debugging, you can use any PC with a home-made I2C adapter:
94
95
p(((. http://www.instructables.com/id/Worlds-Cheapest-I2C-I-Squared-C-Adapter/
96
http://www.paintyourdragon.com/?p=43
97
98
99
h2. Building your own
100
101
To make life easier, we sell premade PCB's and this panel as a kit. See the "WebShop":http://tuxic.nl/webshop.
102
103
The kit contains:
104
105
* PCB
106
* 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->TTL cable).
107
* LCD
108
* other electronic parts
109
* Buttons
110
* I2C wire to motherboard
111
112
Parts it does not contain:
113
114
* 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
115
* 3D Printed joystick button. When I design one I'm really proud of, I might include it.
116
117
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!
118
119
h2. Soldering
120
121 6 jaap
This board has parts on BOTH sides! The display and buttons go on one side, all the other electronic parts go on the other.
122
123
Non-display side: the side where it says "LAOS I2C rev 0.4".
124
* Start by soldering the  the socket for the Atmel IC, making sure the notch is on the same side as the one on the silkscreen legend. 
125
* Place the resistors. There is only one, that's why it's labeled R2
126
* Solder the two 100nF capacitors in U1 and U4.
127
* Solder the 100uF electrolytic capacitor with the plus (longer) wire in the hole with square solder pad (U2).
128
* Solder in the two BS270 in Q1 and Q4.
129
* Solder the 3 pin ceramic resonator (F1)
130
* Solder the piezzo buzzer (SP1).
131 17 jaap
* Solder the I2C pins. Make sure the 4-pin header matches with the cable you're going to use.
132
* Place a regular 2-pin header in P3 and P7 and a 6-pin header in P1 (TTL). Place two 3-pin headers in P4.
133 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.
134 16 jaap
Front (display side):
135 1 jaap
* Place a strong piece of tape or (lasercut) cardboard 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.
136
* Solder the 4 buttons to the board (not the joystick yet!) with the buttons on the side of the display (solder side). 
137 6 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, where there is a small mark on the print. Solder it in.
138 17 jaap
* Solder the display module on the back side board, with the black strip of the 16-pin header in between.
139 1 jaap
140 8 jaap
Front side of the panel.
141 7 jaap
!display-rev0.4.jpg!
142 1 jaap
143 6 jaap
Back side of the panel.
144 7 jaap
!display-back-rev0.4.jpg!
145 1 jaap
 
146
147
h2. Software installation
148
149
h3. Installing a bootloader
150
151 14 jaap
These instructions are for ATMEGA168P-PU
152
<pre>
153
cd /opt/arduino-1.6.4/hardware/arduino/avr/bootloaders/atmega
154 19 jaap
avrdude -p m168p -c usbasp -F -U lock:w:0x3F:m -U hfuse:w:0xDE:m -U flash:w:ATmegaBOOT_168_diecimila.hex -U efuse:w:0xF8:m
155 18 jaap
avrdude -p m168p -c usbasp -F -U lfuse:w:0xff:m
156 15 jaap
</pre>
157 1 jaap
Error message while installing:
158
159
    avrdude: safemode: efuse changed! Was f8, and is now 0
160
Would you like this fuse to be changed back? [y/n]
161
162
Answer n !
163 14 jaap
164
and for the ATMEGA328P-PU
165
<pre>
166
<cd /opt/arduino-1.6.4/hardware/arduino/avr/bootloaders/optiboot
167
avrdude -p m328p -c usbasp -F -U lock:w:0x3F:m -U efuse:w:0x05:m -U hfuse:w:0xDE:m -U flash:w:optiboot_atmega328.hex -U lfuse:w:0xFF:m
168
</pre>
169 1 jaap
170
h3. Arduino Sketch
171
172
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
173
174
To test your panel, change:
175
176
    #define DEBUG 0 
177
178
179
to
180
181
    #define DEBUG 1
182
183
184
Arduino settings: Board: Arduino NG or older with Atmega168
185
186
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.
187
188
If it works, upload the code again with *DEBUG 0*. The panel is now ready to be connected to the mainboard.
189
190 20 jaap
h2. Joystick knob and panel
191 1 jaap
192 21 jaap
To integrate your display in the laser, download Monique's design for a knob + display panel: https://www.youmagine.com/designs/joystick-knob-for-laos-laser
193 20 jaap
194
!https://d36c0vbvwjb9cx.cloudfront.net/uploads/image/file/86573/medium_IMG_20150611_194223.jpg!
195
196 1 jaap
h2. Control Panel on the HPC LS3020
197
198
199
To accomodate the display you can cut a replacement for the control panel. 
200
201
!greenpanel-bart.jpg!
202
203
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.
204
205
206
h2. More
207 8 jaap
208
Previous version: https://redmine.laoslaser.org/projects/laos/wiki/LAOS_I2C_Panel_v03
209 1 jaap
210
For links on previous versions and to get started on designing your own display, see the [[Display-alternatives]] page.
211 13 jaap
212
Cable conn:  Preci-dip, RS: 702-0095