AutoBalance: Week 6


Meron:
This week I focused on redesigning several parts after discovering that certain components did not fit properly in reality and following feedback from Richard, I paid special attention to the front wheel design which required adjustments. In addition, some parts were broken during testing which made it necessary to redraw and improve the design to ensure better durability. Alongside this work I also developed a concept for our final motorbike design and presented a motivational reference image to the teacher which was approved. As result we now plan to create two versions, one prototype that will be 3 D printed and physically and a more detailed final design model that can be delivered as a complete project.  

Salim:
I have been working on controlling a motorcycle using the BitPlayer controller. I Worked with buttons A and B on the controller, where A moves the motorcycle forward and F is shown on the display and B moves it backward, B is shown in the display. The selected direction is displayed on the micro:bit’s screen.
We used radio communication to establish the connection between the micro:bits.

I experimented with several additional functions, but they were not all successful I plan to lokk futher into these further later on.

The default movement mode was defined as mode = 0, where button control (A and B) is active. When button C is pressed, the system switches to joystick mode, where movement is controlled using the joystick’s Y and –Y axes for forward and backward motion. Pressing C again returns the system to the default button mode (mode = 0).

When button D is pressed, the controller switches to tilt mode, which uses the micro:bit’s accelerometer and displays arrows on the LED screen to indicate direction. This mode was defined as mode = 2. Buttons J and T represent these modes on the controller.

The code and demonstration video are provided below.

def my_function():
    pass
joystickbit.on_button_event(joystickbit.JoystickBitPin.P14,
    joystickbit.ButtonType.DOWN,
    my_function)
def my_function2():
    pass
joystickbit.on_button_event(joystickbit.JoystickBitPin.P13,
    joystickbit.ButtonType.DOWN,
    my_function2)

yy = 0
xx = 0
Y = 0
radio.set_group(67)
mode = 0
lastState = "STOP"
basic.show_string("Hello!")

def on_forever():
    global Y, lastState, xx, yy
    if mode == 1:
        Y = pins.analog_read_pin(AnalogReadWritePin.P2)
        if Y < 300:
            radio.send_string("F")
            basic.show_string("F")
            lastState = "FORWARD"
        elif Y > 700:
            radio.send_string("B")
            basic.show_string("B")
            lastState = "BACKWARDS"
        else:
            radio.send_string("S")
            basic.show_string("S")
            lastState = "STOP"
        basic.pause(100)
if mode == 2:
        xx = input.acceleration(Dimension.X)
        yy = input.acceleration(Dimension.Y)
        if yy < -300:
            radio.send_string("F")
            basic.show_leds("""
                . . # . .
                . # # # .
                # # # # #
                . . # . .
                . . # . .
                """)
        elif yy > 300:
            radio.send_string("B")
            basic.show_leds("""
                . . # . .
                . . # . .
                # # # # #
                . # # # .
                . . # . .
                """)
        elif xx < -300:
            basic.show_leds("""
                . . # . .
                . # # . .
                # # # # #
                . # # . .
                . . # . .
                """)
        elif xx > 300:
            basic.show_leds("""
                . . # . .
                . . # # .
                # # # # #
                . . # # .
                . . # . .
                """)
        else:
            radio.send_string("S")
            basic.show_leds("""
                . . . . .
                . . . . .
                # # # # #
                . . . . .
                . . . . .
                """)
        basic.pause(100)
basic.forever(on_forever)

def on_forever2():
    global lastState
    if mode == 0:
        if input.button_is_pressed(Button.A):
            radio.send_string("F")
            basic.show_string("F")
            lastState = "FORWARD"
        elif input.button_is_pressed(Button.B):
            radio.send_string("B")
            basic.show_string("B")
            lastState = "BACKWARDS"
        else:
            radio.send_string("S")
            basic.show_string("S")
            lastState = "STOP"
    basic.pause(100)
basic.forever(on_forever2)

Mohammed A:

This week we tested the motorcycle prototype that meron designed. During the test, we identified several issues, the most critical being that the front axle did not fit properly. As a result, we asked Meron to redesign the part with corrected dimensions. We then consulted Richard to obtain new axles for the updated design. 

Meron adjusted the CAD model to the correct diameter, and we proceeded to 3D print the new components. During assembly, we discovered that the rear wheel had an oversized hole for the axle, which required printing a revised version. Additionally, we produced a wheel to fit the motor shaft.  

On the day the components were completed, just before our meeting, we made further adjustments to the system. Specifically, the motor was repositioned closer to the motorcycle frame in order to prevent the weight from shifting backwards. Another issue we observed was that the plastic mount holding the motor generated friction with the ground. By slightly repositioning the motor, this problem was resolved and the system functioned as intended. 


Leave a Reply