KEMBAR78
Building a robot with the .Net Micro Framework | PPTX
Building a robot with .Net Micro
           Framework
           Ducas Francis
           SC @ Readify
NetMF
• Open Source Platform for small embedded
  applications
• Runs on devices with a 32-bit processor and as
  little as 64K RAM
• Provides the efficiency of creating and
  maintaining devices in managed code
Why NetMF?
•   Use Visual Studio as the IDE
•   Program in C#
•   Same code runs on any NetMF device   with minimal changes


•   Full debugging capabilities
    –   Emulator
    –   Breakpoints
    –   Stepping
    –   Variables
    –   Stack Traces
• Includes many bus drivers
• Managed Code with Garbage Collection
What about Arduino?
• Open Source Platform for electronics prototyping
• Uses the Arduino programming language (C++
  based) and Arduino IDE.
• Benefits
  –   Inexpensive
  –   Cross-Platform Software
  –   Nice IDE
  –   Open Source and Extensible Software (C++ or AVR-C)
  –   Open Source and Extensible Hardware
      (ATMEGA8/168)
NetMF Hardware - Netduino
• Pro – Atmel ARM7    • Go – STMicro Cortex-
  48MHz 128KB Flash     M4 168MHz 384KB
  60KB RAM              Flash 100KB RAM
NetMF Harware - GHI
• FEZ Spider – EMX ARM7 72MHz   • FEZ Cerberus/Cerbuino/Cerb40 –
  3000KB Flash 12000KB RAM        OSHW Cortex-M4 168MHz 300KB
                                  Flash 112KB RAM




• Fez Hydra – OSHW ARM9
  240MHz 3000KB Flash 12000KB   • FEZ Panda II - USBizi-100 ARM7
  RAM                             72MHz 148KB Flash 62KB RAM
Arduino Compatible vs Gadgeteer
• Compatible with          • Sockets over Pins
  Arduino shields          • Modules are pre-built
• Pins over Sockets        • Not all boards have all
• Easy to prototype with     socket types
  breadboards and          • Usually have more
  breakout boards            powerful processors
• More flexible for
  electronics projects
What Are We Building
• Let’s see…
Fez Panda II
Tamiya Dual Motor Gearbox
Tamiya Dual Motor Gearbox
Tamiya Track and Wheel Set
Tamiya Plate Set
Dual Motor Driver
Low Current Motors
Ultrasonic Range Finder
Accelerometer
What you Need
•   Mainboard           • FEZ Panda II $50
•   Motors              • SolarRobotics RM3 2x $4
•   Gearboxes           • Tamiya Double Gearbox (70168) $15
•   Wheels              • Tamiya Track and Wheel Set (70100) $15
•   Housing/Plates      • Tamiya Universal Plate Set (70157) $10
•   Batteries           • 4xAAA + 1x9V $10
•   Motor Driver        • 1A Dual TB6612FNG H Bridge (ROB-
                          09457) $10
• Distance Sensor       • MaxBotix LV-EZ0 Ultrarosnic Range Finder
                          (SEN-08502) $35
• Accelerometer         • Triple Axis Accelerometer ADXL345 (SEN-
                          …) $30

                     Total: ~$150
Or You Could Just Buy a Kit…
• FEZ Mini Robot Kit $120   • RP5 Tank Chasis +
                              Driver $120
What you need to know
• *Basic* electronics
• How to use a soldering iron
• How to cut a little code in C#
NetMF 101
Net MF 101 – What do I have?
• Multithreading
• GC
• Flash access
NetMF 101 – What don’t I have?
• Generics
• A lot of RAM…
NetMF 101
NetMF 101 - IO
•   Digital IO
•   Interrupts
•   Analog IO
•   UART
•   SPI
•   I2C
•   PWM
NetMF 101 – Digital IO
• Pin can either be set to HIGH (true) or LOW
  (false)
• OutputPort.Write(bool)
• bool InputPort.Read()

• Demo - LED
NetMF 101 - Interrupts
• Act when the signal changes from LOW to
  HIGH and vice-versa
• NativeEventHandler InterruptPort.OnInterrupt

• Demo - Bumper
NETMF 101 – Analog IO
•   Read a voltage – not just HIGH/LOW
•   Not part of core NetMF
•   byte AnalogIn.Read()
•   AnalogOut.Set(int value)
•   AnalogOut.Set(byte[] data, int offset, int
    count, int dataRate)

• Demo – Ultrasonic Distance Finder
NETMF 101 – UART Serial Ports
• Use 2 Pins to Communicate between 2 Devices
   – TXD
   – RXD
• Wire to the opposite on each device
   – RXD => TXD
   – TXD => RXD
• new SerialPort(“COM1”, …)
• SerialPort.Read(byte*+, …)
• SerialPort.Write(byte*+, …)

• Demo - XBee
NetMF 101 – I2C
• Use 2 Pins to communicate between master
  and multiple slave devices.
  – SCL
  – SDA
• Provides a bus and ability to define
  configuration and communicate using
  transactions

• Demo - Accelerometer
NetMF 101 - PWM
• Pulse Width Modulation
• Emulates a wave with given frequency and
  duty cycle
• Motors should be given higher frequencies
• PWM.Set(int freqHz, int dutyCycle)

• Demo - Piezo
Building Tank Bot..
•   Build the gearbox
•   Attach the gearbox to the frame and wheels
•   Attach the main board to the frame
•   Attach battery holders to the frame
•   Solder pins to the prototyping board, distance sensor,
    motor driver and accelerometer
•   Solder wires to the motors
•   Attach the distance sensor to the frame
•   Wire the motor driver, distance sensor and
    accelerometer to the prototyping board
•   Write some code…
Test Bots
• Distance Sensor
• Accelerometer
• Motor Driver
Discovery Bot
while (something within 30cm of front)
     avoid

go forward
Safe Discovery Bot
while (bot is tipping)
     avoid

while (something within 30cm of front)
     avoid

go forward
Where to buy…


EOFY2012
Where to learn more…
• tinyclr.com
• netmf.com
• letsmakerobots.com

• sparkfun.com
• bildr.com

• mbed.org
With thanks to our sponsors
Please complete your feedback
  forms, and return them to the
registration desk for a chance
                       to win a
                  Nokia Lumia

Building a robot with the .Net Micro Framework

  • 1.
    Building a robotwith .Net Micro Framework Ducas Francis SC @ Readify
  • 2.
    NetMF • Open SourcePlatform for small embedded applications • Runs on devices with a 32-bit processor and as little as 64K RAM • Provides the efficiency of creating and maintaining devices in managed code
  • 3.
    Why NetMF? • Use Visual Studio as the IDE • Program in C# • Same code runs on any NetMF device with minimal changes • Full debugging capabilities – Emulator – Breakpoints – Stepping – Variables – Stack Traces • Includes many bus drivers • Managed Code with Garbage Collection
  • 4.
    What about Arduino? •Open Source Platform for electronics prototyping • Uses the Arduino programming language (C++ based) and Arduino IDE. • Benefits – Inexpensive – Cross-Platform Software – Nice IDE – Open Source and Extensible Software (C++ or AVR-C) – Open Source and Extensible Hardware (ATMEGA8/168)
  • 5.
    NetMF Hardware -Netduino • Pro – Atmel ARM7 • Go – STMicro Cortex- 48MHz 128KB Flash M4 168MHz 384KB 60KB RAM Flash 100KB RAM
  • 6.
    NetMF Harware -GHI • FEZ Spider – EMX ARM7 72MHz • FEZ Cerberus/Cerbuino/Cerb40 – 3000KB Flash 12000KB RAM OSHW Cortex-M4 168MHz 300KB Flash 112KB RAM • Fez Hydra – OSHW ARM9 240MHz 3000KB Flash 12000KB • FEZ Panda II - USBizi-100 ARM7 RAM 72MHz 148KB Flash 62KB RAM
  • 7.
    Arduino Compatible vsGadgeteer • Compatible with • Sockets over Pins Arduino shields • Modules are pre-built • Pins over Sockets • Not all boards have all • Easy to prototype with socket types breadboards and • Usually have more breakout boards powerful processors • More flexible for electronics projects
  • 8.
    What Are WeBuilding • Let’s see…
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
    What you Need • Mainboard • FEZ Panda II $50 • Motors • SolarRobotics RM3 2x $4 • Gearboxes • Tamiya Double Gearbox (70168) $15 • Wheels • Tamiya Track and Wheel Set (70100) $15 • Housing/Plates • Tamiya Universal Plate Set (70157) $10 • Batteries • 4xAAA + 1x9V $10 • Motor Driver • 1A Dual TB6612FNG H Bridge (ROB- 09457) $10 • Distance Sensor • MaxBotix LV-EZ0 Ultrarosnic Range Finder (SEN-08502) $35 • Accelerometer • Triple Axis Accelerometer ADXL345 (SEN- …) $30 Total: ~$150
  • 19.
    Or You CouldJust Buy a Kit… • FEZ Mini Robot Kit $120 • RP5 Tank Chasis + Driver $120
  • 20.
    What you needto know • *Basic* electronics • How to use a soldering iron • How to cut a little code in C#
  • 21.
  • 22.
    Net MF 101– What do I have? • Multithreading • GC • Flash access
  • 23.
    NetMF 101 –What don’t I have? • Generics • A lot of RAM…
  • 24.
  • 25.
    NetMF 101 -IO • Digital IO • Interrupts • Analog IO • UART • SPI • I2C • PWM
  • 26.
    NetMF 101 –Digital IO • Pin can either be set to HIGH (true) or LOW (false) • OutputPort.Write(bool) • bool InputPort.Read() • Demo - LED
  • 27.
    NetMF 101 -Interrupts • Act when the signal changes from LOW to HIGH and vice-versa • NativeEventHandler InterruptPort.OnInterrupt • Demo - Bumper
  • 28.
    NETMF 101 –Analog IO • Read a voltage – not just HIGH/LOW • Not part of core NetMF • byte AnalogIn.Read() • AnalogOut.Set(int value) • AnalogOut.Set(byte[] data, int offset, int count, int dataRate) • Demo – Ultrasonic Distance Finder
  • 29.
    NETMF 101 –UART Serial Ports • Use 2 Pins to Communicate between 2 Devices – TXD – RXD • Wire to the opposite on each device – RXD => TXD – TXD => RXD • new SerialPort(“COM1”, …) • SerialPort.Read(byte*+, …) • SerialPort.Write(byte*+, …) • Demo - XBee
  • 30.
    NetMF 101 –I2C • Use 2 Pins to communicate between master and multiple slave devices. – SCL – SDA • Provides a bus and ability to define configuration and communicate using transactions • Demo - Accelerometer
  • 31.
    NetMF 101 -PWM • Pulse Width Modulation • Emulates a wave with given frequency and duty cycle • Motors should be given higher frequencies • PWM.Set(int freqHz, int dutyCycle) • Demo - Piezo
  • 32.
    Building Tank Bot.. • Build the gearbox • Attach the gearbox to the frame and wheels • Attach the main board to the frame • Attach battery holders to the frame • Solder pins to the prototyping board, distance sensor, motor driver and accelerometer • Solder wires to the motors • Attach the distance sensor to the frame • Wire the motor driver, distance sensor and accelerometer to the prototyping board • Write some code…
  • 33.
    Test Bots • DistanceSensor • Accelerometer • Motor Driver
  • 34.
    Discovery Bot while (somethingwithin 30cm of front) avoid go forward
  • 35.
    Safe Discovery Bot while(bot is tipping) avoid while (something within 30cm of front) avoid go forward
  • 36.
  • 37.
    Where to learnmore… • tinyclr.com • netmf.com • letsmakerobots.com • sparkfun.com • bildr.com • mbed.org
  • 38.
    With thanks toour sponsors
  • 39.
    Please complete yourfeedback forms, and return them to the registration desk for a chance to win a Nokia Lumia