You choose between a robot arm or a two-wheeled rover, then pair it up with a development board for a microcontroller that is new to you.
The challenge is to connect the bot to the board and then write the firmware to accomplish a simple task. For the robot arm you'll need to pick up a small object and place it in a box. The rover uses an ultrasonic distance senor as its only input. Will you be able to navigate the maze using this crude level of sensing?
Before you arrive:
Both of these robots use servo motors. To succeed at these workshops you will need to use properly timed PWM signals to drive them.
Make sure you hit the ground running on the day of the workshop. Before you arrive do as much research as you can about the boards listed below. Look for servo libraries or research implementing the servo timing yourself. At the very least, set up the toolchains on your computer so that you'll be ready to start coding as soon as you sit down.
If you do not have a workshop ticket:
It's okay, you can still come and have a fun time in several ways. First off, head over to the Hackaday Munich page and get an "All Day" ticket. Now here are your options:
- Bring your laptop computer with you
- We will have more development boards than there are robot bodies. Grab one and decide your own programming challenge. It would help to bring along your breadboard, jumper wires, and some LEDs (or other hardware to play around with). The GPIO levels for most of these boards is 3.3v
- If you already have a wheeled robot or robot arm bring it along! You can write new code for the controller you already have, or connect one of these devboards
For those that already have Robot Workshop tickets:
Get those embedded programming chops ready, this is going to be a ton of fun! Pull out the laptop you plan to bring with you to the workshop and load up the toolchain you would like to use. This will save you a ton of time the day-of the event. Here are details on the development boards we have lined up so far:
Texas Instruments Tiva C Launchpad
TI has committed 20 of their Tiva C Launchpad boards which features the TM4C123GH6PM which is a 32-bit ARM Cortex-M4 running up to 80MHz with 256 KB of flash and 32KB of SRAM. This chip includes hardware-PWM generators which will come in handy for these challenges.
Resources:
- Product page: http://www.ti.com/tool/ek-tm4c123gxl
- Development tools:
- Code Composer Studio is available for free (code-limited): http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/c2000_performance/tools_software.page#ccstudio
- Development using a Linux machine is possible.
- You will need to install an arm-none-eabi-xxx toolschain.
- We asked on Twitter about this and the pre-compiled toolchain maintained by Pebble (the smartwatch company) was suggested: https://developer.getpebble.com/download-sdk/linux/
- It has been suggested the the arm-none-eabi-gcc package in the Ubuntu 14.04 repos is not up to day. You may consider trying this PPA: https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded
- Install OpenOCD (to flash the binary to the board)
- A template for compiling your code is found here: https://github.com/szczys/tiva-c-launchpad-template
- Don't forget the TivaWare Package which includes header files and peripheral libraries: http://www.ti.com/tool/sw-tm4c
- You will need to install an arm-none-eabi-xxx toolschain.
TI has also committed 20 SimpleLink WiFi Boosterpacks and 20 Sensor Hub BoosterPacks.
Atmel SAM D20 Xplained Pro Evaluation Kit
Atmel has committed 20 of their SAM D20 Xplained Pro evaluation kits. These feature a ATSAMD20J18 which is an ARM Cortex-M0+ running up to 48 Mhz with 256 KB of Flash and 32 KB of SRAM.
Resources:
- Product page: http://www.atmel.com/tools/atsamd20-xpro.aspx
- Development Tools:
- Atmel Studio: http://www.atmel.com/microsite/atmel_studio6/default.aspx
- Development using a Linux machine is possible:
- Guide: https://plus.google.com/+AndreyYurovsky/posts/5JTehC7ngTq
- I used this PPA for the toolchain: https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded
- There are some typos (remove the '4' in the OpenOCD config file name, etc.)
- I had to explicitly enable cmsis-dap when configuring OpenOCD: ./configure --enable-maintainer-mode --enable-cmsis-dap --enable-hidapi-libusb
- If you get an error finding the libhidapi-redraw.so.0 see here: http://karibe.co.ke/2013/08/setting-up-linux-opensource-build-and-debug-tools-for-freescale-freedom-board-frdm-kl25z/
- Guide: https://plus.google.com/+AndreyYurovsky/posts/5JTehC7ngTq
Examples:
- Atmel's API for PWM: http://www.atmel.com/Images/Atmel-42123-SAM-D20-D21-Timer-Counter-Driver-TC_Application-Note_AT03263.pdf
Freescale FRDM-KL25Z Freedom Board
Freescale is sending their FRDM-KL25Z Freedom Board to the Hackaday Munch Embedded Hardware Workshop. This board features the MKL25Z128VLK4 which is an ARM Cortex-M0+ chip that runs at up to 48MHz with 128KB Flash and 16KB SRAM.
Resources:
- Product Page: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL25Z#
- Development Tools:
- Evaluation versions of IDE include CodeWarrior and Keil: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL25Z&fpsp=1&tab=Design_Tools_Tab
- You can use the mBed environment: http://developer.mbed.org/handbook/mbed-FRDM-KL25Z-Getting-Started
- Requires a simple firmware upgrade: http://developer.mbed.org/handbook/mbed-FRDM-KL25z-Upgrade
- Linux Bare Metal template: https://github.com/payne92/bare-metal-arm
- We haven't tested this yet
- It has been suggested the the arm-none-eabi-gcc package in the Ubuntu 14.04 repos is not up to day. You may consider trying this PPA: https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded
- Mega-resource for GNU ARM tools for these Kinetis boards: http://mcuoneclipse.com/2013/07/20/dyi-free-toolchain-for-kinetis-part-1-gnu-arm-build-tools/
Examples:
Microchip TCHIP010 Fubarino SD Board
Microchip has offered up 20 of their Fubarino SD Boards. These Open Hardware boards host a PIC32MX795F512H chip which runs at up to 80 MHz, boasts 512KB of Flash and 128KB of RAM.
Resources:
- Product page: http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=TCHIP010&utm_source=MicroSolutions&utm_medium=&utm_term=&utm_content=&utm_campaign=Fubarino+SD+Dev+Board
- Fubarino website: http://fubarino.org/
- Program using MPIDE (a fork of the Arduino IDE): http://chipkit.net/started/install-chipkit-software/
Hobby Servos and Ultrasonic Sensors
The Challenge in this workshop isn't merely to get a toolchain for an unfamiliar chip architecture working. We actually need to so something with the hardware. Blinking LEDs is always a good proof that everything is working, but we want to go further. Let's drive some robots using servo motors. If you're awesome at that you can also try your hand at reading from an ultrasonic distance sensor.
Controlling Servo Motors
Servo motors are a great step beyond driving an LED because they require precise timing. Here's the workflow I would recommend for developing a servo motor driver:
- Blink an LED
- This shows that you know how to control the GPIO pins. If you blink at 1 second intervals it is also a simple check to let you know that you are (probably) correctly calculating a delay based on the system clock
- Dim an LED using PWM
- Whether you're using hardware or software based PWM, dimming an LED gives you simple visual feedback that you've got it working
- Figure out your servo timings
- Now alter your LED dimming code to use a period of 20ms with a pulse width of 1ms and 2ms. I like to use a delay function to change the duty cycle between the two values. If you look closely you should still be able to see a change in the brightness of the LED
- Testing and troubleshooting
- Connect it to one of the servo motors
- Make sure you are using an in-line resistor to protect the logic circuitry inside the servo in case you've connected it incorrectly
- If the servo isn't moving, don't leave it plugged in. Instead, head on over to the oscilloscope and measure your signal to get feedback on the timing problem
- Connect it to one of the servo motors
Reading an Ultrasonic Distance Sensor
US-100 Datasheet (kind of)
There is a quick tutorial on reading this sensor using an Arduino and the NewPing library: http://arduino-info.wikispaces.com/UltraSonicDistance
The New Ping library itself shows just how easy it is to read from this sensor. You can read the sensor using as UART if the jumper on the back side is in place. But it is very easy to read it without the jumper in place by measuring the pulse-width. You pull the trigger pin high-then-low to signal the start of a reading, then measure the echo pin. Start counting system cycles when that pin goes high, stop counting when it goes low, and use the difference to calculate distance.
Here is the code from the NewPing library that performs the measurement I just described:
// ---------------------------------------------------------------------------
// Standard ping methods
// ---------------------------------------------------------------------------
unsigned int NewPing::ping() {
// Trigger a ping, if it returns false, return NO_ECHO to the calling function.
if (!ping_trigger()) return NO_ECHO;
// Wait for the ping echo.
while (*_echoInput & _echoBit)
// Stop the loop and return NO_ECHO (false) if we're beyond the set maximum distance.
if (micros() > _max_time) return NO_ECHO;
// Calculate ping time, 5uS of overhead.
return (micros() - (_max_time - _maxEchoTime) - 5);
}
// ---------------------------------------------------------------------------
// Standard ping method support functions (not called directly)
// ---------------------------------------------------------------------------
boolean NewPing::ping_trigger() {
#if DISABLE_ONE_PIN != true
// Set trigger pin to output.
*_triggerMode |= _triggerBit;
#endif
// Set the trigger pin low, should already be low, but this will make sure it is.
*_triggerOutput &= ~_triggerBit;
// Wait for pin to go low, testing shows it needs 4uS to work every time.
delayMicroseconds(4);
// Set trigger pin high, this tells the sensor to send out a ping.
*_triggerOutput |= _triggerBit;
// Wait long enough for the sensor to realize the trigger pin is high. Sensor specs say to wait 10uS.
delayMicroseconds(10);
// Set trigger pin back to low.
*_triggerOutput &= ~_triggerBit;
#if DISABLE_ONE_PIN != true
// Set trigger pin to input (when using one Arduino pin this is technically setting the echo pin to input as both are tied to the same Arduino pin).
*_triggerMode &= ~_triggerBit;
#endif
// Set a timeout for the ping to trigger.
_max_time = micros() + MAX_SENSOR_DELAY;
// Wait for echo pin to clear.
while (*_echoInput & _echoBit && micros() <= _max_time) {}
// Wait for ping to start.
while (!(*_echoInput & _echoBit))
// Something went wrong, abort.
if (micros() > _max_time) return false;
_max_time = micros() + _maxEchoTime; // Ping started, set the timeout.
return true; // Ping started successfully.
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Are you sure? yes | no
1. Is it compatible?
2. IDE : Energia, embedXcode or other?
thanks!
Are you sure? yes | no
Are you sure? yes | no