Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Devoxx4Kids
Lego Kids Workshop
Stephen Chin
Java Community Manager
JavaOne Content Co-Chair
@steveonjava
LeJOS
How it works on the EV3
The Heart of the EV3
> TI Sitara AM1808
 ARM9, 300Mhz
> 64MB RAM / 16MB Flash
> Analog to Digital Converter
> 4 Motor Por...
EV3 Motors
EV3 Sensors
Color and Light Sensor
High frequency
sound waves
Measuring mode Vs Presence Mode
Ultrasonic Sensor
Infrared Sensor
Remote Control
Getting Started with LeJOS
> Micro SD Card (> 2GB)
> Compatible WIFI adapter
 NetGear WNA1100
 EDIMAX EW-7811Un
> Linux ...
Lego Duke Segway
Windows USB Connection
Step 1: The wrong driver gets installed, so we need to fix this in the
Device Manager
13Credit to t...
Windows USB Connection
Step 2: In Device Manager, find your EV3’s RNDIS device. It is
under Network Adapters > USB Etherne...
Windows USB Connection
Step 3: Double-click it and select the Drivers tab. Click Update
driver… to change the driver.
15Cr...
Windows USB Connection
Step 4: Select Browse my computer for driver software.
16Credit to the ev3dev team for the great sc...
Windows USB Connection
Step 5: Click Let me pick from a list of device drivers on my computer.
17Credit to the ev3dev team...
Windows USB Connection
Step 6: Uncheck the box that says Show compatible hardware. In
the Manufacturer list, pick Microsof...
Windows USB Connection
Step 7: Windows thinks we don’t know what we are doing, but really
we do, so click Yes.
19Credit to...
Windows USB Connection
Step 8: When it is done installing, click Close.
20Credit to the ev3dev team for the great screen c...
Eclipse Setup
> Open Eclipse
> Go to "Preferences"
> Click on leJOS EV3
> Change the brick name to
the IP address of your ...
Creating a New LeJOS Project
> Go to "File" > "New" > "Project…"
> Choose a LeJOS EV3 Project
22
Create a Class File
> Create a new class ("File" > "New"
> "Class")
> Give it a package (e.g. sample)
> Give it a name (e....
Simple LeJOS Application
public class EV3FirstProgram {
public static void main(String[] args) {
LCD.clear();
LCD.drawStri...
Stephen Chin
tweet: @steveonjava
blog: http://steveonjava.com
nighthacking.com
Real Geeks
Live Hacking
NightHacking Tour
H...
Parts you will need Step 1
Assemble Brace
Step 2 Completed Brace
Assemble Brace
Parts you will need Step 1
Build Base
Step 2 Completed Base
Build Base
Motor parts Snap them on partially
Assemble Motor
Take motor and base And connect them like this
Assemble Motor
Foot parts Step 1
Add a Foot
Step 2 Add the Foot to the Base
Add a Foot
Assembled Foot and Base
Add a Foot
Lock parts Partially insert the red attachers
Add a Lock
Attach the lock Push down the red attachers to secure
Add a Lock
Tower parts Step 1 – push the rod all the way through
Construct the Tower
Step 2 Attach the Tower to the Base
Construct the Tower
Completed Tower
Construct the Tower
Fan Motor parts Step 1
Build the Fan Motor
Completed Fan Motor
Build the Fan Motor
Light Sensor parts Step 1
Construct the Light Sensor
Completed Light Sensor
Construct the Light Sensor
Fan Blade parts Step 1
Assemble the Fan Blades
Fan Blade, Light Sensor, and Fan Motor Completed Fan
Assemble the Fan
Assembled Wind Turbine
46
Wind Turbine Wiring
> Port A – Medium Moto
 Power Fan
> Port B – Large Motor
 Rotate Wind Turbine
> Port 1 – Light Senso...
Gear Box parts Step 1
EC: Gear Box Construction
Completed Fan with Gear Box
EC: Gear Box Construction
Making the Wind turbine turn
public class WindTurbine {
public static void main(String[] args) {
EV3MediumRegulatedMotor f...
Making the Tower spin
public class WindTurbine {
public static void main(String[] args) {
EV3LargeRegulatedMotor base =
ne...
Checking the Ambient Light
public class WindTurbine {
public static void main(String[] args) {
EV3ColorSensor light =
new ...
Putting it all together…
> Can you write a program that will:
1. Rotate the fan in a circle
2. Check the ambient light whi...
Stephen Chin
tweet: @steveonjava
blog: http://steveonjava.com
nighthacking.com
Real Geeks
Live Hacking
NightHacking Tour
Safe Harbor Statement
The preceding is intended to outline our general product
direction. It is intended for information p...
Upcoming SlideShare
Loading in …5
×

Devoxx4Kids Lego Workshop

29,408 views

Published on

Slides for a Lego Workshop using Java coding via Lejos to create a wind turbine using the Lego EV3 core education set. Workshop was given at the Devoxx4Kids bay area chapter on May 2nd.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Devoxx4Kids Lego Workshop

  1. 1. Devoxx4Kids Lego Kids Workshop Stephen Chin Java Community Manager JavaOne Content Co-Chair @steveonjava
  2. 2. LeJOS How it works on the EV3
  3. 3. The Heart of the EV3 > TI Sitara AM1808  ARM9, 300Mhz > 64MB RAM / 16MB Flash > Analog to Digital Converter > 4 Motor Ports > 4 Sensor Ports > Bluetooth / USB > MicroSD
  4. 4. EV3 Motors
  5. 5. EV3 Sensors
  6. 6. Color and Light Sensor
  7. 7. High frequency sound waves Measuring mode Vs Presence Mode Ultrasonic Sensor
  8. 8. Infrared Sensor
  9. 9. Remote Control
  10. 10. Getting Started with LeJOS > Micro SD Card (> 2GB) > Compatible WIFI adapter  NetGear WNA1100  EDIMAX EW-7811Un > Linux (or a Linux VM) > Details here: Creating Your SD Card http://sourceforge.net/p/lejos/wiki/Home/
  11. 11. Lego Duke Segway
  12. 12. Windows USB Connection Step 1: The wrong driver gets installed, so we need to fix this in the Device Manager 13Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  13. 13. Windows USB Connection Step 2: In Device Manager, find your EV3’s RNDIS device. It is under Network Adapters > USB Ethernet/RNDIS Gadget. 14Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  14. 14. Windows USB Connection Step 3: Double-click it and select the Drivers tab. Click Update driver… to change the driver. 15Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  15. 15. Windows USB Connection Step 4: Select Browse my computer for driver software. 16Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  16. 16. Windows USB Connection Step 5: Click Let me pick from a list of device drivers on my computer. 17Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  17. 17. Windows USB Connection Step 6: Uncheck the box that says Show compatible hardware. In the Manufacturer list, pick Microsoft Corporation (in Windows 8, pick Microsoft). In the Network Adapter list, pick Remote NDIS Compatible Device. Then click Next. 18Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  18. 18. Windows USB Connection Step 7: Windows thinks we don’t know what we are doing, but really we do, so click Yes. 19Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  19. 19. Windows USB Connection Step 8: When it is done installing, click Close. 20Credit to the ev3dev team for the great screen captures and writeup: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/?tabs-0=windows-7-8
  20. 20. Eclipse Setup > Open Eclipse > Go to "Preferences" > Click on leJOS EV3 > Change the brick name to the IP address of your brick  (default is 10.0.1.1) 21
  21. 21. Creating a New LeJOS Project > Go to "File" > "New" > "Project…" > Choose a LeJOS EV3 Project 22
  22. 22. Create a Class File > Create a new class ("File" > "New" > "Class") > Give it a package (e.g. sample) > Give it a name (e.g. LCDTest) 23
  23. 23. Simple LeJOS Application public class EV3FirstProgram { public static void main(String[] args) { LCD.clear(); LCD.drawString("First EV3 Program", 0, 5); Button.waitForAnyPress(); LCD.clear(); LCD.refresh(); } }
  24. 24. Stephen Chin tweet: @steveonjava blog: http://steveonjava.com nighthacking.com Real Geeks Live Hacking NightHacking Tour Hacking Time!
  25. 25. Parts you will need Step 1 Assemble Brace
  26. 26. Step 2 Completed Brace Assemble Brace
  27. 27. Parts you will need Step 1 Build Base
  28. 28. Step 2 Completed Base Build Base
  29. 29. Motor parts Snap them on partially Assemble Motor
  30. 30. Take motor and base And connect them like this Assemble Motor
  31. 31. Foot parts Step 1 Add a Foot
  32. 32. Step 2 Add the Foot to the Base Add a Foot
  33. 33. Assembled Foot and Base Add a Foot
  34. 34. Lock parts Partially insert the red attachers Add a Lock
  35. 35. Attach the lock Push down the red attachers to secure Add a Lock
  36. 36. Tower parts Step 1 – push the rod all the way through Construct the Tower
  37. 37. Step 2 Attach the Tower to the Base Construct the Tower
  38. 38. Completed Tower Construct the Tower
  39. 39. Fan Motor parts Step 1 Build the Fan Motor
  40. 40. Completed Fan Motor Build the Fan Motor
  41. 41. Light Sensor parts Step 1 Construct the Light Sensor
  42. 42. Completed Light Sensor Construct the Light Sensor
  43. 43. Fan Blade parts Step 1 Assemble the Fan Blades
  44. 44. Fan Blade, Light Sensor, and Fan Motor Completed Fan Assemble the Fan
  45. 45. Assembled Wind Turbine 46
  46. 46. Wind Turbine Wiring > Port A – Medium Moto  Power Fan > Port B – Large Motor  Rotate Wind Turbine > Port 1 – Light Sensor  Track Ambient Light 47
  47. 47. Gear Box parts Step 1 EC: Gear Box Construction
  48. 48. Completed Fan with Gear Box EC: Gear Box Construction
  49. 49. Making the Wind turbine turn public class WindTurbine { public static void main(String[] args) { EV3MediumRegulatedMotor fan = new EV3MediumRegulatedMotor(MotorPort.A); fan.setSpeed(1500); fan.setAcceleration(150); fan.backward(); Delay.msDelay(10000); } }
  50. 50. Making the Tower spin public class WindTurbine { public static void main(String[] args) { EV3LargeRegulatedMotor base = new EV3LargeRegulatedMotor(MotorPort.B); base.setSpeed(80); base.rotateTo(-90); base.rotateTo(90); } }
  51. 51. Checking the Ambient Light public class WindTurbine { public static void main(String[] args) { EV3ColorSensor light = new EV3ColorSensor(SensorPort.S1); float[] sample = new float[1]; SensorMode mode = light.getAmbientMode(); mode.fetchSample(sample, 0); LCD.drawString("Light = " + sample[0], 0, 4); Delay.msDelay(5000); } }
  52. 52. Putting it all together… > Can you write a program that will: 1. Rotate the fan in a circle 2. Check the ambient light while rotating 3. Move back to the brightest angle 4. Spin the fan http://commons.wikimedia.org/wiki/Wind_generator#mediaviewer/File:Eolienne_et_centrale_thermique_Nuon_Sloterdijk.jpg
  53. 53. Stephen Chin tweet: @steveonjava blog: http://steveonjava.com nighthacking.com Real Geeks Live Hacking NightHacking Tour
  54. 54. Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

×