1. Building a robot with .Net Micro
Framework
Ducas Francis
SC @ Readify
2. 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
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)
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 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
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…