Close
0%
0%

Edubot Controller (Benny)

An affordable educational robot for the classroom for South Africa

Similar projects worth following
The goal is to create an affordable robot for educational use. In too many classrooms I have seen that the school buys a few mindstorms or similar kits. These are so expensive that they can only afford to buy 3 or 4 max, and some schools can't even buy that much. At the end of the day your students have minimal physical interaction with these kits because they need to share them. The mindstorm kits are also overkill for most educational lessons. We also have a problem with a bad exchange currency so importing stuff gets expensive. The physical parts of the robot is not so much a problem, but the electronics gets expensive quickly. The cheapest option is to get an arduino + motorshield + bluetooth. This is already cheaper than a mindstorms kit, but it is also reliant on having the stock available in South Africa

This is a project to create alternative hardware in South Africa that would be less expensive and give every student a robot to play with.


The goal is to create a decent robotics controller for as cheap as possible (obviously quantities make electronics cheaper, but if we can make it cheap in low qty then it can only get cheaper with higher qty).

Obviously the hardware is pretty much useless without proper software. I would need to develop software and lesson plans to make it useful in an educational environment.

Hardware Goals:

  • Inexpensive
  • Integrated Motor Drivers
  • USB Connectivity for easy loading of firmware
  • A few IO for basic sensors
  • Plug and Play - essentially add motors/chassis and some power and it should work
  • Bluetooth (This is optional, but opens up lots of possibilities)

For the initial design we settled on the following components:

- STM32F042 - ARM processor with integrated usb (no crystals!) and dfu firmware loading capabilities
- LB1838M-TRM-E - Full Bridge Motor Driver Bidirectional Motor
- MIC5219-3.3V - 3.3v Regulator
- HC-06 - Bluetooth Module


These components were chosen due to availability and price in South Africa. I'm sure there are cheaper and better parts available, but if I can't get them easily in low qty then it doesn't help me.

Software Goals:

  • Need to cater for various skill levels (From young children (pre-school) all the way to university students).
  • Simple 1 package install for various skill levels
  • Lesson Plans

On the software side I want to divide it into the following parts of skill levels:

Level 1: Simple

This level consists of basic firmware loaded on the controller and a android app. The app allows you to drive the robot around and toggle various io and modes. This enables everyone regardless of their skill level to get hands on experience on the robot. It is also a good test for the robot to test its functions once the student assembled a chassis and connected the motors and power.

Level 2: Easy

This level consists of a graphical interface to program the edubot with basic functions/tasks. For this level I want to hack/integrate blockly - a library for visual programming.

Level 3: Moderate

Level 3 would be the step between visual programming and plain c on the stm32 microcontrollers. The idea here is to create an easy to use library that can be used by students to program the robot without getting into the low level stuff required on a stm32. While inspired by the arduino library, to avoid confusion I'm calling it the easylib for the edubot controller.

Level 4: Difficult

This level doesn't require any new software. Give a university student a gcc compiler, datasheet and the controller ;)

  • 1 × STM32F042 STM32 MCU - F0 Series - TSSOP20 Package
  • 1 × LB1838M-TRM-E Power Management ICs / Motion, Motor and Servo Control
  • 1 × MIC5219-3.3v 3.3V Voltage Regulator
  • 1 × HC-06 Bluetooth Module

  • It's Nothing without Software...

    Tom Van den Bon05/11/2016 at 14:58 0 comments

    So having an educational robot is all and good. But it's pretty useless without some decent software to program it.

    Level 1 and Level 4 is relatively sorted. (Remember, Level 1 is a basic android app to control the robot and Level 4 is essentially regular stm32 programming using the available toolchain). Level 2 and Level 3 are however very important since most users will use those.

    For a quick reminder, Level 2 is a visual programming interface using blockly and Level 3 is an arduino type library that lets you concentrate more on the logic of your robot and less on the low level initialization of the stm32 pheripherals.

    For level 3, I'm taking inspiration from the Arduino library. This means that the functions are basic control functions for setting inputs and outputs and a few Benny Bot specific commands (like the motor control).

    For example a basic program that reacts on a digital distance sensor (in this case the Sharp GP2Y0D810Z0F Digital Distance Sensor) for basic obstacle avoidance would like look this:

      setPinMode(IO7, PIN_MODE_INPUT);
    
      setMotorDirection(MOTOR_LEFT, MOTOR_DIRECTION_FWD);
      setMotorDirection(MOTOR_RIGHT, MOTOR_DIRECTION_FWD);
      setMotorSpeed(MOTOR_BOTH, 100);
    
      while (1)
      {
        if ( getPinState(IO7) == HIGH )
        {
          setPinState(LED, HIGH);
          setMotorDirection(MOTOR_LEFT, MOTOR_DIRECTION_FWD);
          setMotorDirection(MOTOR_RIGHT, MOTOR_DIRECTION_FWD);
          setMotorSpeed(MOTOR_BOTH, 100);
        }
        else
        {
          setPinState(LED, LOW);
          setMotorDirection(MOTOR_LEFT, MOTOR_DIRECTION_REV);
          setMotorDirection(MOTOR_RIGHT, MOTOR_DIRECTION_FWD);
          setMotorSpeed(MOTOR_BOTH, 100);
          HAL_Delay(100);
        }
      }

    I created the following functions for testing this library, which I call the easylib library
    // functions
    
    // motor functions
    void setMotorSpeed(uint8_t Motor, uint8_t Speed);
    void setMotorDirection(uint8_t Motor, uint8_t Direction);
    
    // io functions
    void setPinMode( uint8_t pin, uint8_t mode );
    void setPinState( uint8_t pin, uint8_t state);
    uint8_t getPinState( uint8_t pin );
    

    The library also consists of defines for motor/io selection to make things easier:

    #define IO1 0					// gpio/i2c sda/
    #define IO2 1					// gpio/uart/pwm	** bluetooth module connected to this pin - SJ1
    #define IO3 2					// gpio/uart/pwm	** bluetooth module connected to this pin - SJ2
    #define IO4 3					// gpio/i2c scl
    #define IO5 4					// gpio
    #define IO6 5					// gpio/spi mosi/pwm
    #define IO7 6					// gpio/spi miso/pwm
    #define IO8 7					// gpio/spo sck/pwm
    #define BUTTON 8				// input
    #define LED    9				// output
    
    
    #define MOTOR_LEFT	0
    #define MOTOR_RIGHT 1
    #define MOTOR_BOTH  2
    
    #define MOTOR_DIRECTION_FWD 0
    #define MOTOR_DIRECTION_REV 1
    
    #define PIN_MODE_INPUT  0
    #define PIN_MODE_OUTPUT 1
    #define PIN_MODE_ANALOG 2
    
    #define HIGH 1
    #define LOW  0
    
    Obviously this library still needs a lot more functionality, but it does have enough to get Level 2 working.



    For level 2 I settled on using the Google blockly library. I've been hard at work having it generate code that can be compiled by the gcc compiler. The idea is similar to how the arduino ide works, it generates the basic program that gets included in the bigger project when it gets compiled. The code it generate is basically the various easylib (from Level 2) functions.

    Blockly works great for generating the code, but getting it loaded onto the benny bot is a different story. Initially I just copied and pasted the generated the code into my c file and ran a makefile. It works, but not ideal for a classroom environment.

    To improve this I create a basic python server based on CherryPy. When the user clicks on the 'Program Benny' button, it performs the following actions:

    1. Create generated code based on the blocks
    2. Insert the generated code into a base project
    3. Compile the base project and generate the firmware
    4. Convert firmware to dfu format
    5. Try and load firmware to connected dfu bootloader over usb.

    I currently have the basic concept working from blocks to firmware loaded onto Benny, but it still needs work in terms of error checking/handling, reliability....

    Read more »

  • Hardware - PCB 0.2

    Tom Van den Bon05/05/2016 at 14:59 0 comments

    Version 0.2 of the pcb is up and running. It's essentially the same than 0.1 with a few changes.

    • Added a pwr header so you can select whether the mcu powers from usb or from external power. The previous board only powered up when the external power was applied. While this is how it would normally work, it is annoying when you want to develop on it without actually driving any motors because it needs to be externally powered.
    • Added a reset button. On 0.1 we just switched power when switching between bootloader and normal operation.
    • Moved some pins around to clear up a UART. 0.1 had the motor driver pins on the UART pins.
    • Added a HC-06 Bluetooth module

    The rest of the features are carried over from 0.1:

    • Integrated Motor Driver
    • User button to put in bootloader mode or use in user application
    • USB interface for programming courtesy of builtin stm32f042 bootloader

    All the basics has been tested and working :) So very happy!

View all 2 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates