loading

This is a small tutorial for making a gyroscope cube that sends data through bluetooth. The data it sends is meant to be used with smart home devices or computer applications.

Step 1: Materials Needed

You'll need these materials:

  • CC2541 bluetooth 4.0 LE chip
  • MPU9255
  • Screw terminal
  • 3.3v voltage regulator
  • Capacitor 104
  • 10v capacitor
  • Atmega328p 8mhz
  • Pin headers (optional)
  • Protoboard(s)
  • Dip-28 socket
  • 3.7v LiPo battery

Disclaimer: There are different MPU9255 and CC2541 chips, you'll need to look up datasheets that apply to your version. For this reason pin locations may vary. I used a JDY-08 chip which I don't recommend (bad documentation).

Step 2: Preparations

First off make sure your Atmega328p microchip is running on the 8mhz internal clock.

You can look up how to do this here:

https://www.arduino.cc/en/Tutorial/ArduinoToBreadb...

You'll also need a cube to put your materials in. I made mine with a 3d printer. It's 65x65x65mm, with 2,5mm thick walls, so it has a 60mm volume. My protoboard had 4 holes on each side, so I made four cylinders where the board could be put in and out. You'll have to make one yourself, as dimensions and mounting systems differ with the materials you bought.

The bluetooth chip (JDY-08) needs a couple of pins soldered.

https://docs.google.com/document/d/14mHWT3GhELCj-6...

In the google docs above there is datasheet that shows where every pin needs to be connected;

  • VCC (3,3v)
  • GND
  • RST (reset)
  • P03 (RXD)
  • P02 (TXD)
  • P00 (PWCR for AT commands)

The picture has two additional pins (SDA and SCL) soldered, this is not required.

You can configure the bluetooth chip with the PWCR connected to ground. When sending AT commands through serial, make sure the chip is in HOST mode and has an open channel for data.

Step 3: Soldering Parts Together

Put the dip-28 socket on the protoboard. The atmega328p chip will be put into this socket. Carefully solder the screw terminal, voltage regulator and capacitors according to the schematic above. The optional part is creating pin headers that can connect to a FTDI. If you instead want to take out the chip and place it on the arduino to upload code, that is possible too.

The image above shows how the parts need to be connected. The RXD and TXD pins of the bluetooth chip need to be connected with pin 7 and 8 on the microchip in cross position. The SDA and SCL pins of the MPU9255 need to connected with the A04 and A05 pins.

Make you sure you connect the VCC pins after the power went through the voltage regulator, so it has a 3.3v voltage. For ground this doesn't matter.

Step 4: Upload Your Code and Assemble

Upload this code to your microchip:

https://github.com/flammified/iotcube/tree/master/...

When connecting the battery to the screw terminal, be careful with handling it. LiPo batteries are highly sensitive to air (when exposed) and doesn't short circuit.

When everything is connected you should check if any data is coming through with app like BLE scanner. Connect to the device and check your assigned channel to see if you receive any gyrscope data.

Put your materials and sensors in your 3d printed cube and close it with a lit. Make sure it's a tight fit so it doesn't rattle and come loose.

Step 5: Read Data

To read data use this python script:

https://github.com/flammified/iotcube/tree/master/...

It currently only works on linux (sadly). I'm working on different gateway methods.

Visualisation software is located here:

https://github.com/flammified/iotcube/tree/master/...

Run a MQTT server and it will show the gyroscope data as a 3d cube in threejs.

That's all for now, in the future the software will get updated so that it'll be easier to use. Thanks for reading.

Cool remake of the Xiaomi SmartHome Cube. The biggest advantage of this is it can be used more flexible and adapted. Gotta try it.
<p>Cool project. You should enter this into the Sensors contest.</p>

About This Instructable

3,184views

45favorites

License:

More by BrentC50:IoT Gyroscope Bluetooth Cube 
Add instructable to: