BLDC Skateboard Part 7

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:

  1. Start in LPM4
  2. A joystick button press exits LPM4 and enables the radio
  3. Every 250ms, send out the joystick value and trigger an ADC conversion to read the next value of the joystick
  4. When data is received, parse the data and toggle the LEDs based on the status of the drive
  5. If the button is held down for 3 seconds, put the radio to sleep and enter LPM4

On the drive side:

  1. 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.
  2. 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:

Register Name Value
IOCFG0 0x06
PKTLEN 0x3D
PKTCRL1 0x0E
PKTCTRL0 0x05
ADDR Set to address value for device
FSCTRL1 0x0D
FREQ2 0x21
FREQ1 0x6B
FREQ0 0x24
MDMCFG4 0x0D
MDMCFG3 0x2F
MDMCFG2 0x03
MDMCFG1 0x21
MDMCFG0 0xE5
DEVIATN 0x71
MCSM0 0x18
FOCCFG 0x1D
BSCFG 0x1C
AGCCTRL2 0xC7
AGCCTRL0 0xB0
FREND1 0xB7
FSCAL3 0xEA
FSCAL2 0x2A
FSCAL1 0x00
FSCAL0 0x1F

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!

Leave a Reply

Your email address will not be published. Required fields are marked *