Skip to content

Robot project for training purpose at Pamasol. Apprentices learn how to build a small robot and program it with C.

License

Notifications You must be signed in to change notification settings

pamasol/Lehrlingsprojekt-Nibo-Burger

Repository files navigation

NIBO Burger – Pamasol electronic project for apprentices

Pamasol Willi Mäder AG has specialized in the development and production of solutions for aerosols and spray systems since 1965.

Its "Automatiker Lehrlinge" (German for mechatronic apprentices) go through a 4-year apprenticeship. They get an on the job training by qualified Pamasol employees and go to college one or two days per week.

At Pamasol they work on customer projects as well as on internal training projects. NIBO Burger represents the internal electronic training project. It pursues the following goals:

  • Improving soldering skills
  • Getting familiar with PCBs and electronic components (diode, LED, transistor, capacitor, amplifier, microcontroller)
  • Acquiring knowledge of integrated circuits (motor bridges, odometry, USB programmer)
  • Learning microcontroller programming with C and C++
  • Becoming acquainted with control loops like PID controller
  • Understand the difference between asynchronous (UART) and synchronous communication protocols
  • Using Git as software version control system and GitHub for collaborative software development
  • Enhancing documentation and presentation skills
  • Getting comfortable with project definition and datasheets in English (native language of most apprentices is Swiss-German)

nibo_rabbit_warren_02
NIBO Burger in action. It detects the black line with its surface sensors and controls the motors accordingly. This is an exercise that the trainees will program during the project.

Table of contents:

  1. Robot construction kit NIBO Burger
  2. Assembling NIBO Burger
  3. Programming with Microchip Studio and Git
  4. Documentation
  5. Robot tasks
  6. Bonus task: Optical robot tuning

In a first step the robot kit is presented, followed by robot assembling, programming and documentation. The tasks that the robot must solve are described in the last chapter.

1. Robot construction kit NIBO Burger

The NIBO burger robot kit is a free programmable robot that can act autonomously with its environment. It is equipped with an Atmel ATmega16 AVR main controller, 9 sensors and a slot for ARDUINO shields where for example an 8x8 LED matrix display can be mounted. It comes as an assembly kit that is provided by nicai-systems, Germany.

NIBO Burger with 8x8 LED matrix display Powered via 4x1.2V AAA battery
NIBO Burger with 8x8 LED matrix display Powered via 4x1.2V AAA battery
IR and color sensor bricks Sensor protection wings
IR and Color sensor bricks Sensor protection wings

Image source

Features of NIBO Burger:

  • Main processing unit Atmel ATmega16A, 16 kByte flash, 15 MHz
  • 4 IR-Sensor-Bricks for contactless collision avoidance
  • 3 Color-Sensor-Bricks (R+G+B) for surface color detection
  • 10 Slots for variable sensor configuration
  • 2 motors with 25:1 / 125:1 gear ratio
  • 2 IR-sensors for rotation speed detection

Additional information can be found on the product website: www.nicai-systems.com/en/nibo-burger

Purchasing NIBO Burger and LED matrix display

Best offer we could find for purchasing a NIBO Burger in Switzerland at time of writing.

NIBO Burger Robot

Maroon Shield LED Display

Please let us know if there are better deals out there.

2. Assembling NIBO Burger

How to assemble the robot is described detailly in the manual that is provided with the robot.

It starts with interpreting and sorting the items followed by preparing the workplace and the soldering station. One should proceed as recommended in the instructions to avoid issues when putting the boards together to a burger. A lot of attention should be paid to the gearbox. If it is not assembled in the right angle, it jams afterwards and the motors cannot work properly.

The microcontroller is preprogramed. One can run the function tests as soon as the hardware work is done. Everything will be checked, starting with the LEDs, the odometry sensors, the IR- and RGB-Sensors and ending with the motors.

8x8 pixel matrix display

The maroon shield 8x8 matrix display is super easy to assemble. That is why its manual consists of 2 pages only.

Unfortunately, marron shield is not as good documented as the robot itself. There is an official wiki for the communication protocol that can be found here (German only).

Luckily we were able to add some additional information about the display. How it works is described in the wiki area of this repository. Check it out.

3. Programming with Microchip Studio and Git

Before continuing make sure Chapter "3 Preparation for operation" in the English Manual or Chapter "3 Inbetriebnahme" in the German Manual has been processed. So you can be sure the hardware works before you load your own programs.

There are several ways to program the NIBO Burger. The easiest way is via online compiler of roboter.cc, another way is via Arduino IDE or via Microchip Studio (former name Atmel Studio and AVR Studio). We use Microchip Studio 7 in this project.

Installing software

  1. Install latest NIBO Burger library from roboter.cc or from SourceForge. Current version of time of writing is NiboRoboLib 3.6.0.
  2. Install Microchip Studio 7 from microchip.com website.
  3. Install Visual Studio Code from Microsoft.
  4. Install WinAVR which is a distribution of the avr-gcc compiler that is used on Windows operating systems.
  5. Install Git from git-scm.com

As soon as the programs above are installed, one can add specific Microchip Studio settings for NIBO Burger as described on the Wiki page. Check Microchip Studio 7 Setup for NIBO Burger and do project settings and flavours (WinAVR compiler).

There is a German documentation for the NIBO Burger library on docs.roboter.cc/niborobolib-3.6/niboburger/html

Using Git and GitHub

Git is the most widely used modern version control system in the world. It tracks changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its setup has to be performed as follows.

  1. Generate an SSH key and connect your Git with GitHub as described here.

  2. Right click on desktop > Git Bash Here and run following commands. Use your email and your GitHub user name.

git config --global user.email "you@example.com"
git config --global user.name "Your Name"
  1. Ask your Pamasol instructor for adding you to this repository.

  2. Clone the project as follows

git clone https://github.com/pamasol/Lehrlingsprojekt-Nibo-Burger.git
  1. Add your changes with
git add –all
  1. Commit changes with
git commit -m “here what I did and want to commit”
  1. Push commits to GitHub
git push
  1. Load latest commits
git pull

4. Documentation

This project must be documented by every apprentice. It should be structured as follows:

  • Front page
  • Summary
  • Table of contents
  • Table of images
  • Table of tables
  • Freely selectable chapters that explain:
    • Construction of the robot
      • What is a microcontroller?
      • How is 3.3V generated on the PCB?
      • Explain motor bridge and PWM signals.
      • How does an IR sensor work?
      • For what does RGB stand for in the RGB-Sensors?
      • What is the difference between flash and EEPROM storage and how much does the ATmega16A have of each?
      • Why is it possible to use only 16 microcontroller outputs for controlling 64 LEDs on the display?
    • Programming and software
      • In which programming language do we program the robot?
      • What is the scope of a variable in C?
      • For what can a for loop be used?
      • What is a function in C?
      • How can a state machine be created in C code?
      • What is the difference between C and C++ and can the robot be programmed in C++ or just in C?
      • What is the job of microcontroller IC5 in NIBO Burger?
      • For what does the robot need the crystal oscillator Q1 (15MHz)?
      • What is a compiler and which compiler is used in this project?
      • Why is UART interface asynchronous and is there a clock or not?
      • What is Git and GitHub? Is there a difference?
      • What is open-source software?
    • Personal experiences
      • How did the assembling go?
      • What should be considered when programming?
      • What should future learners pay attention to?
      • Explain the electrical schematic in general. What is motor controlling, display control, USBasp, battery charging and so on.
  • Appendix

Take following notes when creating the documentation:

  • Can be written in German language
  • Minimum of 4 pages (exclusive front page summary, index and appendix)
  • Use your own words, don’t copy text from the internet 1 to 1
  • Every image, table or formula needs to be referred in the text
  • Don't forget source citation

A Pamasol Microsoft Word Template can be requested from the instructor.

Documentations from apprentices that have finished this tutorial are listed here (German language).

5. Robot tasks

The robot tasks are divided into two parts, the exercise tasks and the master tasks. The exercise tasks can be done with help of NIBO burger Coding Tutorial. Do not create a new project in Microchip Studio for every task, use Git instead efficiently.

Exercise tasks

A) Flashing LED1

LED 1 should flash for 0.5sec and then pause for 0.5sec. This process should be repeated infinitely and therefore be placed in the void loop().

Solution

B) For loop

The C for loop statement is used to execute a block of code repeatedly. It is often used when the number of iterations is predetermined. Use a for loop for switching on LED1 up to LED4.

Solution

C) Switch on LED2-LED4

Update program B) from above with the result that only LED2 up to LED4 are on.

Solution

D) Flashing LEDs 1

Create a program where LED 1 is flashing for 0.5sec and then pausing for 0.5sec, then LED 2 is flashing for 0.5sec and then pausing for 0.5sec and so on up to LED4. Don't use a for loop.

Solution

E) Flashing LEDs 2

Write same program as above in D) but work with a for loop. What is the advantage of a for loop in this case?

Solution

F) For in for

Next program E) from above in a loop that increases the time from 50 to 100 and 200 milliseconds (each iteration double of time).

Solution

G) Using buttons

Analyze this program which uses buttons and a switch case statement.

Now add an event for button 3. If this button is pressed, LED3 should flash and as soon as the button is released, LED3 should switch off.

Solution

H) Light switch

Write a program, based on this initial situation that switches on LED1 and LED4 when button 1 is clicked. LED2 and LED3 should switch on when button 2 is clicked.

All LEDs should switch off when button 3 is clicked.

Solution

I) Odometry sensors

Check this program. The photoelectric sensors that are placed in the transmission are called odometry sensors.

The program measures the readings of the left odometry sensor and switches on LED1 as soon as it counts more than 10 and LED2 when it is more than 20. The counter of left odometry sensor can be reset (counter back to 0) with clicking button 1 or button 3.

Implement the same behavior for the right odometry sensor. Clicking button 2 resets right odometry counter whereas clicking button 3 should reset both. The program can be tested by turning the red gear.

Solution

J) Playing with motors

The motors have to be initialized via motpwm_init(); in the setup function. Check setup function in this program.

The program furthermore explains local and global variables and the motor control. Extend it as follows: When button 3 is released motor power variable should be decreased by 200.

Solution

K) Sensor calibration

In this exercise one will calibrate the color sensors of the robot. Therefore create a program with this content, compile it and download it to the robot. Put robot on a black surface and click button 1. In a second step, put the robot on a white surface and click button 2.

Since the RGB values will be stored in the EEPROM, they will not get lost anymore, even when turning off or reprogramming the robot. Furthermore a new variable type is used: unsigned long int what is a 2 byte variable that can be positive only (no - in front).

If everything went well, LED1 is flashing when sensors detect a black surface. LED2 is flashing when sensors detect a white surface.

L) Infrared sensors

Take a look at this program. It switches off all LEDs when IR-Sensor (respectively phototransistor) in slot FL does not receive reflected infrared light from the IR diode. The better the reflection gets, the more LEDs are flashing. Update the code as follows.

When there is no reflection at IR Sensor FR (not FL), all LEDs are switched off. Is there a bit reflection, LED1 switches on. Is there more reflection, LED2 switches on additionally and so on until LED4 for high reflection.

Solution

M) Visualize obstacle

As starting point serves this piece of code. Write a program that works with all 4 IR sensors in front of NIBO Burger.

Does FLL sensor reflection valves bigger than 20, LED1 should flash. Implement same procedure for FL sensor and LED2, FR sensor and LED3 and FRR sensor and LED4.

Solution

N) Moving robot

Compile and download this program to your robot. Check also documentation of the max(argument_a, argument_b) function that is used in this program.

When there are no obstacles within the robot's reach, it moves forward with 80% of max speed. If there are obstacles on the left or on the right, one motor stops and the robot eludes the obstacle.

This program can be improved in many ways. For example the LEDs could indicate what the IR sensors detect. The control of the wheels can be made more smooth. The program could start as soon as button 1 is pressed and so on. All of these improvements are covered in the master tasks

O) Maroon Shield 8 x 8 LED pixel display

Before continuing read the two chapters "4.0 8x8 pixel matrix display" and "5. Programming Maroon Shield" in this project wiki. Then load this program on your NIBO Burger together with the header file maroon.h and try to understand. Feel free to modify the output on the matrix display.

What a header file does is explained in gcc.gnu.org. When you build the solution, the compiler takes the content from the header file and puts it in your main.c file.

Master tasks

The following 5 tasks must be mastered, whereas the apprentice can choose the order by himself.

A) Round trip

The robot should move 1.5m or more in one direction, turn 180° and move back to its origin.

Layout drawing round trip (Nibo01_V1.0.pdf)

B) Fraidy cat

The robot should avoid obstacles to the right or left as shown in this video.

Layout drawing fraidy cat (Nibo02_V1.0.pdf)

C) Follow me

The robot should follow a human hand as shown in this video.

Layout drawing follow me (Nibo03_V1.0.pdf)

D) Colour detection

The robot should detect white and black surfaces as well as the colours blue, red, yellow and green. Colours should be indicated on the 8x8 pixel display as shown in this video.

Layout drawing colour detection (Nibo04_V1.1.pdf)

E) Rabbit warren

The robot should follow a path from point A to B as shown in this video.

Layout drawing rabbit warren (Nibo05_V1.0.pdf)

Help for this task can be found in the wiki section "E) Rabbit warren thoughts".

6. Bonus task: Optical robot tuning

Upgrade your robot optically and functionally with a spoiler, diffuser or bumpers, for example. A suitable program for drawing the components is Autodesk Fusion 360 as the screenshot below shows.

2022-05-11_18-25-16

A simplified NIBO Burger robot, that serves as base for your tuning kit, can be found here with and here without spoiler. Downloads:

Fusion 360 for personal use is a limited free version for individuals who are doing hobby, non-commercial projects that includes basic functionality and can be renewed on a 3-year basis.

About

Robot project for training purpose at Pamasol. Apprentices learn how to build a small robot and program it with C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published