In Part 1, I determined what components were needed to turn the motor I found.
In Part 2, I determined what parts were needed to attach the motor to the skateboard wheel.
In Part 3, I created the mount and attached the motor to the skateboard.
In Part 4, I applied current to the motor to correctly label the wiring and hall effect sensors for use in a commutation table for trapezoidal control.
In Part 5, I set up the hardware and hall effect sensor connections.
In Part 6, I created the BLDC trapezoidal control firmware and made the motor spin.
In this part, I will cover setting up the CC110L boosterpacks on both the motor control launchpad and the MSP430 launchpad to create a wireless controller for the skateboard. I will also discuss the analog input used for the controller.
When I started this project, I wanted to try to use some CC110L radios I had left over from a previous project. These are sub-GHz transceivers that use an SPI interface to the MCU. They plug directly into the launchpads I am using and are relatively inexpensive.
First, the links on the TI website that point to the Anaren site for more information on the CC110L boosterpack do not really work. Here is the user manual for the CC110L boosterpack that I downloaded back when the links did work. This contains the connector pinouts, jumper settings, and schematics that are missing otherwise.
Luckily, the board is set up to very easily plug right into the MSP430 launchpad and work. I modifed the jumpers a bit and am using:
- P1.4 = CSN
- P1.5 = SCLK
- P1.6 = MISO
- P1.7 = MOSI
- P1.3 = GD0
However, there is little to no online explanation if the CC110L boosterpack will work with the TMS320F28069 launchpad. With the boosterpack plugged into J5 and J6:
- GPIO26 = CSN
- GPIO14 = SCLK
- GPIO25 = MISO
- GPIO24 = MOSI
- GPIO27 = GD0
Vcc and GND match up and none of the necessary pins are currently in use on the TMS320F28069, so the radio should function properly.
Now that we have radio communication that should work between the remote and drive, we need a good way to get input into the remote. After a little bit of online searching, I found this pretty slick analog joystick potentiometer with button. I made a quick board that plugs into the MSP430 launchpad with the joystick mounted. This puts the analog input into P1.1 of the MSP430, adds a couple of LEDs to toggle based on feedback from the drive, and sticks the button on P2.0.
The remote control firmware is fairly straightforward:
- Start in LPM4
- A joystick button press exits LPM4 and enables the radio
- Every 250ms, send out the joystick value and trigger an ADC conversion to read the next value of the joystick
- When data is received, parse the data and toggle the LEDs based on the status of the drive
- If the button is held down for 3 seconds, put the radio to sleep and enter LPM4
On the drive side:
- When data is received, parse the data and set the torque command based on the value received. If the torque command is above a certain threshold, enable the PWM and spin the motor.
- Send status data out every second. The status data tells us if the PWM is enabled, if there are any faults or warnings, the motor RPM, and the battery voltage.
The tricky part of configuring the radio is setting up the RF settings over SPI. I have the radios configured for 903MHz, 250Kbps, and 2-FSK modulation. I am also using the packet handling hardware support. This gives each radio packet a 4-byte sync word, a CRC checksum computation and check, an address check, and a packet length check. I then filter the received messages by address and ignore the messages if the CRC is invalid. Here are the values of my configuration registers:
|ADDR||Set to address value for device|
Once the configuration registers are updated over SPI, make sure to put the radio into RX mode if you expect to receive any data.
In the next part we will put it all together and see how the skateboard moves!