Anth's Computer Cave

AAIMI GPIO Tutorial Hub

AAIMI GPIO is a web-based control interface for the Raspberry Pi and Arduino. Check out the tutorials below.


Using PWM with AAIMI GPIO

Today we'll use AAIMI GPIO to run a bi-directional PWM motor and a PWM LED.

PWM Motor

I have a motor hooked to GPIO27 and GPIO22 via a motor-controller. Let's get it running.

A motor and motor-controller connected to the Raspberry Pi GPIO pins. Picture: Anthony Hartup.

Click the button for your first motor pin, in my case GPIO27, and press Change setting.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

Name your motor and Select PWM Motor

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

Click next.

Just like the standard input from the previous article, choose a default state for your motor, Low or High

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

Select 'Manually switch on and off'

Now you can enter the motor-specific details for the pin.

In my case the second pin number for my motor is 22.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

I've entered zero for my starting speed. You can enter any speed and the motor will start at that speed when you switch it on. One issue with non-zero starting speed at the moment, however is the speed adjustment slider in the speed tab will display zero until you adjust the speed. After that it will reflect the actual speed. I'll fix that in the next version.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

You should now see the motor pin set as output in the pin list.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

In the Run tab I can now see my motor beneath the LED and PIR sensor I added in the previous article.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

If I click the motor heading and press On, the motor will power on and the Speed window appears.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

In my case the motor is not yet spinning because I chose zero as the starting speed. If I slide the speed slider to the right, the motor revs up to the chosen speed.

If you click on the Backwards button the motor will stop for two seconds to allow it to stop spinning. It will then start in the opposite direction at its default speed.

PWM LED

The steps for using a PWM LED are almost identical to using a motor. The main difference is not needing to enter the second pin, because a LED only needs one pin.

Once again, click on the pin for your LED and press Change stettings.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

This time select PWM Output.

As with all outputs, choose the default state and type of control.

Choosing a manual on/off output using AAIMI GPIO. Picture: Anthony Hartup.

Enter the starting PWM speed, or brightness for your LED, then click finish.

The speed control for the LED brightness is the same speed slider used for the motors, just without the Direction buttons.

Cheers

Anth


Previous: Using AAIMI GPIO PWM

Next: Using stepper motors with AAIMI GPIO

_____________________________________________


Comments

Leave a comment on this article