Posted on Leave a comment

3D Printed Arduino + Bluetooth Tank

3D Printed RC Tank

I’ve been working on a new remote controlled tank in my spare time. My goal with this project is to make a cheap, printable RC tank kit. This post goes back and forth between talking about the tank, and a basic tutorial on how the components and code work together.

Currently it’s a working prototype. The tank uses an Arduino Nano clone (ATmega328) as the primary board. An L298n H-Bridge is used to control the left and right motors independently, allowing it to quickly turn or revese. It uses the HC-06 Bluetooth module to receive commands. The power comes from two 18650 batteries that are connected in series.

3D Printed RC Tank

 

Hardware:

I purchased the majority of the hardware from Aliexpress, because it’s so cheap. The links below are to the stores that I used, but you can find the same parts on many websites other than Aliexpress.

  • Arduino Nano V3 Clone ( AtMega328p ) – Link
  • L298n H-Bridge Motor Controller – Link
  • HC-06 Bluetooth Module – Link
  • 2x DC Motor + 64:1 Gearbox – Link
  • 2x 18650 Battery – I took mine from an old laptop, wired them in series for 7V+
  • 1x 500mA Polyfuse – Optional, put between power source and VIN

 

I salvaged some steel weights from an old set of window blinds, and super-glued them to the base to add some weight.

Tank Front View
Tank Front View

 

Frame:

The frame of the tank was printed as a solid piece. There are four mounting spots for wheels. The two at the front are designed so that small bearings will slot into them, so that the front wheels spin freely. The other two of the mounts are designed to hold the gearbox motors. I made a T-shape in the center of the frame so that I can mount a breadboard on top of the frame. The frame design leaves much to be desired, it’s much too thin and flexible.

This slideshow requires JavaScript.

The front and rear wheels have teeth that are spaced out, so that they catch on the inside of the cable-chain tracks. The teeth are tapered slightly to keep the tracks aligned, and there is a guard on the front wheels to ensure that they stay on. The battery holder has holes in the sides and bottom so that wires can pass through. Screws hold the wheels in place.

RC Tank Sideview
RC Tank Sideview

 

Schematic:

The Arduino and L298N are powered using two 18650 batteries. These are fairly common rechargeable batteries, with an output around 3.7V. I wired my batteries in series. My schematic says 7.2V, that’s a typo, it’s really 7.4V+. I use the VIN pin on the Arduino Nano to power the chip.

The 5V output on the Arduino powers the HC-06 module. Make sure that you’re using an HC-06 module with a breakout board like mine, so that it is 5V tolerant. This is because the raw HC-06 chip is NOT 5V tolerant.

Pins 2 and 3 are connected to the HC-06, and pins 4 through 7 are connected to the L298N. On the L298N, pins ENA and ENB are used for PWM control of the outputs, so that you can achieve finer speed control. I don’t utilize these, so they are set high.

Schematic

 

Code:

There are only two main components to control other than the Arduino itself, they are the HC-06 and the L298n. The HC-06 is going to receive data from an external source, and then pass it to the Arduino. Then the Arduino will make a decision, and send signals to the L298N to turn on the motors.

There is a link at the bottom to download the full code, or read through and copy/paste the example blocks.

 

Startup:

The program imports the SoftwareSerial library, and establishes pins for motor control. A char named btData is used to handle incoming Bluetooth data. Then pins 2 and 3 are declared as RX and TX using SoftwareSerial.

//SoftwareSerial library is included so that we can utilize pins 2 and 3 for the HC-06
#include <SoftwareSerial.h> //Pins 4, 5, 6, 7 used for motors.
const int motorRF = 4; //RF = Right motor, Forward direction 
const int motorRR = 5; //RR = Right motor, Reverse direction 
const int motorLF = 6; //LF = Left motor, Forward direction 
const int motorLR = 7; //LR = Left motor, Reverse direction 
char btData; //char used for bluetooth data - receives commands like "1", "2", "a", etc. 

SoftwareSerial HC06(2,3); //RX, TX - Pins 2 and 3 used for HC-06 Module

 

Setup:

Serial communication is set up, and a string saying “Hello” is sent as a self-check. Then digital pins 4, 5, 6 and 7 are declared as outputs, in order to send signals to the L298n.

void setup() {
  HC06.begin(9600); //Begin serial at 9600 baud as "HC06"
  HC06.println("Hello."); //Sends "Hello." through serial, to acknowledge startup

  pinMode(motorRF, OUTPUT); //Sets pins 4 through 7 to OUTPUTs, to control the L298N
  pinMode(motorRR, OUTPUT);
  pinMode(motorLF, OUTPUT);
  pinMode(motorLR, OUTPUT);
}

 

Loop:

The loop works by cycling until data is available at the HC-06 module. When data is received, it enters the loop and then makes decisions. In this case, I use the numbers 1 through 4 to control the state of the L298N. When a ‘1’ is received, the Arduino sets pins 4 and 6 to HIGH, so that the L298N enables the outputs in a manner that turns both motors forwards. I use a delay function, so that it keeps the motor on for a second.

void loop() {
  //Loops until data is sent to HC06
  
  if (HC06.available()){ //When data is available in the HC06, do this
    
    HC06.println("Reading."); //Prints "Reading." through serial, to acknowledge incoming data
    btData = HC06.read(); //Reads "HC06" and stores the value into the char "btData"

    if (btData=='1'){ //If the HC-06 receives a 1, do this
      HC06.println("Forward."); //Sends "Forward." through serial, to acknowledge that a 1 was received
      digitalWrite(motorRF, HIGH); //Activates the motors so that the tank moves forwards
      digitalWrite(motorLF, HIGH);
      delay(1000); //Delays for approximately one second
      
    }
    if (btData=='2'){ //If the HC-06 receives a 2, do this
      HC06.println("Reverse."); //Sends "Reverse." through serial, to acknowledge that a 1 was received
      digitalWrite(motorRR, HIGH); //Activates the motors so that the tank moves backwards
      digitalWrite(motorLR, HIGH);
      delay(1000); //Delays for approximately one second

    }
    if (btData=='3'){ //If the HC-06 receives a 3, do this
      HC06.println("Left."); //Sends "Left." through serial, to acknowledge that a 1 was received
      digitalWrite(motorRF, HIGH); //Activates the motors so that the tank rotates left
      digitalWrite(motorLR, HIGH);
      delay(1000); //Delays for approximately one second
    }
    if (btData=='4'){ //If the HC-06 receives a 4, do this
      HC06.println("Right."); //Sends "Right." through serial, to acknowledge that a 1 was received
      digitalWrite(motorLF, HIGH); //Activates the motors so that the tank rotates right
      digitalWrite(motorRR, HIGH);
      delay(1000); //Delays for approximately one second

    }
    digitalWrite(motorLF, LOW); //Turns all of the motors off, by setting everything to LOW
    digitalWrite(motorLR, LOW);
    digitalWrite(motorRF, LOW);
    digitalWrite(motorRR, LOW);
  }
}

Download the full code here.

 

Connecting to the HC-06

I use the mobile app Bluetooth Electronics to connect to and send commands to my HC-06 module. I like using my phone since I can follow the car around. You can also use PuTTy, or another program to send serial commands to the HC-06 from a laptop or desktop.

The HC-06 becomes available for pairing when it is powered on. Pair your device with it, using the default password of “1234“. Once your device is paired with the HC-06, you’ll be able to connect to it using your program of choice.

To connect to it using Bluetooth Electronics, make sure that you’ve paired your device with the HC-06 and then open Bluetooth Electronics. Click “connect” at the top, and select your HC-06 from the list. Assuming you wired it correctly and it’s paired, you will now be able to send commands to it through the app. The app makes it incredibly simple to create a customized GUI for sending commands to the tank.

 

Future Design Ideas

I plan on making a lot of changes to this tank. I’m going to redesign the majority of the frame and the connection points on the wheels so that they are stronger. I want to increase the number of batteries to 3, so that it’s capable of higher speeds. The battery holder design is a little bit too short, requiring tape to stay closed, so I’ll fix that in the next revision.

 

I am working on a standalone program so that the project can be controlled in an easier manner. Instead of having it drive for predetermined lengths of time according to command-line strings, I plan on having a GUI with realtime feedback. There are a lot of options for making a program like this. I have been experimenting with python to some success, but I might resort to using one of the many application builders that are available. For right now, the Bluetooth Electronics app meets all of my requirements so I’ll continue down that path until I need more complicated functionality.

 

A great upgrade for the system would be to use an ESP8266. It would provide greater control options, and it would lower the cost and footprint. The extreme simplicity of the Arduino and HC-06 combination make it very easy to use and adapt, so I am going to continue using it for this project. Plus, I have a bunch of Nanos and HC modules sitting in a drawer collecting dust; it’s about time I turned them into something. My next RC vehicle project will hopefully utilize wifi.

 

More on this project is coming.

Thanks for reading!

 

Posted on Leave a comment

Designing and 3D Printing a Multi-Color Business Card

3D Printed Business Card
3D Printed Business Card
3D Printed Business Card

 

Earlier today I was experimenting with multiple shades/colors and materials using my Prusa i3 Mk2s. I have some black PETG from Fused Filaments, and some natural NextPage PLA. I wanted to see if I could combine them, so I tried to make a minimalistic business card.

 

Designing The Card

I used 3DS Max to design this card. Virtually every 3D modeling software has tools that let you follow the basic steps that I outline here. I tried to keep it as simple as possible. The basic design idea is split into two parts –

  • solid background in one color or material
  • raised features like text/border/design in another color or material

This slideshow requires JavaScript.

Base:

I made the base of the card by creating a 90mmX50mmX0.4mm rectangle. I chamfered the edges so that it would be more comfortable to hold.

Text:

I made a text spline and then extruded it to be 0.4mm thick. Then I positioned it on top of the base.

I find that Arial Round MT Bold is a great font to use for 3D printing, because it has nice corners and good legibility.

Border:

I made an outline of the edge of the card, and positioned it on top of the base like I did with the text. It is 0.4mm thick, like the text.

3D Printed Business Card
3D Printed Business Card

Printing

I sliced the model using the latest version of Prusa3D Slic3r. I used the following settings on my Prusa i3 Mk2S:

  • 100 micron layers (0.4mm standard Optimal setting)
  • 215C 1st layer
  • 205C PLA layers ( 2nd to 4th layer )
  • 240C PETG layers  ( 5th to 8th layer )

I uploaded the model to the Slic3r ColorPrint webpage and used their tool to modify the G-Code. I simply set it to request a color change after completing the background. When I inserted the PETG, I had to make sure to adjust the temperature to 240C using the tune option on the LCD panel.

 

Design Thoughts

I thought that it would be best to use my natural PLA for the background, and the PETG for text to get a sharp contrast. The opposite would work well, but I thought that the transparency of the natural PLA would be nice as a background. The PETG also requires a printing temperature of ~240C, so it has no problem adhering to a PLA surface. Printing PLA onto PETG might have adhesion problems, because of the lower printing temperature of PLA.

There was minor stringing with the PETG because I was using my standard PLA settings, and only changed the temperature during the color change. It still turned out quite nice considering how little effort I put into it. I started by printing one card, and then I printed six cards at once. Both batches turned out nice.

Stringing on PETG lettering
Stringing on PETG lettering

The cards are pretty flexible but still firm with a 0.4mm base and 0.4mm border. The text gives a really nice tactile feedback when you run your fingers across it. I’m going to try printing them with a base thickness of 0.6mm instead of 0.4mm. The 90mmX50mm size profile is standard, but you could go any direction with the shape or size or design. There’s so many options.

The PETG lettering stuck firmly to the PLA. I twisted, bent and crushed one of the cards and it didn’t break or lose letters. I had to use a knife to peel the letters off, and they were pretty stubborn. The borders didn’t stick as well as the letters, though. I was able to peel the border off of two cards with my fingernails. Perhaps it was too thin.

Crushed Business Card
Crushed Business Card

I am going to experiment with further modifying G-Code, so that I don’t have to manually adjust the temperature after a material switch. Maybe I should pick up some black PLA so I that I don’t have to fuss with temperatures.

 

Posted on Leave a comment

Designing & 3D Printing A Star Vase With 3DS Max

Star Vase printed with transparent purple AMZ3D PLA

I’m going to describe the basic process I go through to design and then 3D print a vase using 3DS Max. The basic techniques can be applied to many different modeling programs.

 

Step 1:

Navigate to the splines section and select the Star tool.

Step 1

Step 2:

Place a star spline with your desired dimensions and number of points. The filet option can be used to smooth the edges.

Step 2

 

Step 3:

Select the star. Select Extrude from the Modifier List. Enter the desired height. Use 1 vertical segment for this example, with the rest of the settings at default.

 

Step 3

Step 4:

Select the star. Right click, and select Convert To: Editable Poly

Step 4

 

Step 5:

Select the top face of the object, and twist it.

Step 5

 

Step 6:

With the top face still selected, shrink it to your desired size to create a taper.

Step 6

 

Step 7:

Export the model as an STL from 3DS Max, and import it into your slicing program. I use Slic3r and repetier host.

To use vase mode, you have to have:

  • 1 External Perimeter
  • 0 Top Layers
  • Spiral vase mode enabled (obviously)

I find that using 3 bottom layers is fine, but you can use more to make it less tippy.

Step 7

Step 8:

Once the model is sliced, print it using your printer and desired settings. I printed this one using transparent purple PLA from AMZ3D. It came out alright; I should have printed a bit slower.

Star Vase printed with transparent purple AMZ3D PLA
Star Vase printed with transparent purple AMZ3D PLA

 

You can download the model on Thingiverse:

http://www.thingiverse.com/thing:2105789

 

Thanks for reading! I hope you learned something. Have a great day.

Posted on Leave a comment

Designing and 3D Printing an Integrated Circuit Holder

3D Printed Integrated Circuit Holder

3D Printing / 3D Printed Integrated Circuit Holder

3D Printed Integrated Circuit HolderI spend way too much time on Aliexpress in the middle of the night. As a result, I’ve amassed a huge collection of assorted ICs. Who can resist a pack of 20 ICs for $1 with free shipping? Not me, that’s who. I enjoy making models and I have a 3D printer, so took a crack at solving the problem by designing and 3D printing my own IC organizer.

 

I designed it so that each compartment would hold a single 8-pin IC, and to use as little plastic as possible. Compartments can be added or removed to hold as many ICs as needed, and can be positioned into whatever configuration is desired.

 

I started by creating a basic design, which was just a box that was slightly larger than a standard 8-pin IC. More boxes were used to create the rough profile of an IC. Then I subtracted the IC profile from the original box using the Advanced Boolean tool. I added a notch  to each side of the holder to make it easier to add or remove ICs. Then I copy and pasted the individual holder until I had as many as I desired.

 

Printing involved exporting the model as an STL through 3DS Max. I imported it into Repetier Host, sliced the model using Slic3r and then I printed it on my Kossel Delta.

 

Here’s a video of the entire process, from initial design to 3D printing to being used.

 

I used the following printer settings:

  • 0.4mm nozzle width
  • 0.3mm layer height
  • 200C nozzle temperature
  • 103% extrusion multiplier
    • Better bonding and surface finish at 103%, but reduced dimensional accuracy
  • 120mm/s internal speed, 90mm/s surface speed
  • 25% speed first layer

 

Download the 3DS Max and STL files:

http://www.thingiverse.com/thing:2007972

 

Leave a comment:

Posted on Leave a comment

ProGrow Update #4 – SD Card, Analog Buttons & 3D Printed Enclosures

ProGrow Version 1.0

ProGrow Update #4

ProGrow Version 1.0
ProGrow Beta

 

I completely revamped the layout and configuration of the modules on the front of the ProGrow. I designed and printed some basic enclosures for all of the different little modules to help isolate each unit and tidy it up. It’s still a mess of wires, but I’m making progress on the overall design. I used 3DS Max to design the basic enclosures, and then I used my Kossel Delta printer to make them. Most of the things were printed using white PLA, but I ran out and used black PLA to print the 9V battery enclosure.

3D Printed Enclosures

This slideshow requires JavaScript.

 

I’ve successfully added an SD card module to store data for the long term. I have a spare 16gb MicroSD in there right now, so I have a few years worth of samples that I could store. I’m going to change the SD card to a smaller, more robust one to help avoid catastrophic accidental corruption. I use the SPI.h and SD.h libraries in order to read/write to the SD card and I store the sensor data in a .txt file. I’m working on graphing the data automatically, but it’s not a priority right now.

 

4 Buttons Connected To One Analog Output
4 Buttons Connected To One Analog Output

I removed the 4 digital buttons that I was using for manual control. I made a circuit that outputs an analog signal instead of a digital one, and connected the buttons to a free analog pin. This freed up 4 digital pins for future use. I use a few series resistors to create different analog signals that gets sent out through the purple wire in the image above. The buttons are placed so that they will see different levels of resistance from the chain of resistors when pressed. The programming simply reads the analog value and then makes decisions based off of the value. Much more pin-efficient than before!

 

The LED display made the old RGB indicator light obsolete, so I removed it. This gives me even more digital pins for future use.

 

I’m going to work on reducing the power draw, and implementing batteries next. I’ll be publishing a parts list sometime soon.