Monday, 14 June 2021

Making the BBB Red ESC

 In this post I'll explain why, and how I designed the Bristol Bot Builders N20 Red ESC electronic speed controller for small robots.

The Antweight / 150g robot ESCs

There are quite a few commonly used ESCs available.

  • Various "dual channel" speed controllers with or without mixing - these come as a board with lots of flying leads and it's important to connect them correctly. BBB does a special one for Ants which has braking (most don't)
  • My previous project - the Malenki Nano - which has a built-in receiver
  • The DFRobot N20 

The advantage of the DFRobot controller, is that it's build on the back of the N20 motor and can be plugged directly into a receiver. This makes it easy for newbies and flexible for different designs. It also simplifies the wiring - these robots are very small and it can often be difficult to cram all the wires into the chassis.

The good and bad of the DFRobot:

Good:

  • Very easy to use for newbies
  • Flexible for designs
  • Simple wiring

Unfortunately there are some problems: 

Bad

  • No braking
  • Many reports that these controllers fail on 2S lipo packs (8.4v maximum) after prolonged or regular use
  • The supplied lead is much too long for these small robots
  • Comes already soldered to a N20 motor - if it isn't the type you want - then you need to desolder it and put on a different motor.

So in this project, I tried to fix all the bad things but keep all the good things :)

Features 

Feature

DFRobot

Red ESC

Maximum voltage


about 6v (all day)

8.4v (for a while perhaps?) 

9v forever :)

Orientation

"Vertical"

Horizontal

Braking

No

Yes
Lead
>200mm
80mm
 

Design notes

Connectors

Choosing connectors is one of the most difficult things! The DFRobot esc uses a JST-XH 2.5mm pitch connector. To make it fit, they've put the connector on the opposite side of the board from the other components, and it uses the full width of the board. This means that it's a double-sided assembly. I didn't want to do double-sided assembly as it increases costs and I'm working at a much lower volume.

There are a bewildering array of connectors available, but I eventually settled on the incredibly tiny JST-SH 1mm pitch surface mount and wire-mount connector. Assembly of leads for prototyping was likely to be impossible (it is a super tiny crimp), so I bought some already-crimped leads with bare wires, and crimped my own servo connectors on the other end.

Orientation

I cannot take credit for this, it was Joe's idea. The idea was simply to have the pcb a similar size/shape as the dfrobot, but with the terminals in a different orientation, so it can go out "sideways" from the motor, 

DFRobot (left), Red ESC (right),

 

 
This makes the setup work better for thin robots.
 

Cable assembly

This was a new experience for me - finding a random company to assemble cables. I am pleased that it worked very well.
The crimping for the jst-sh end  is critical - I also wanted to make sure that the wire colours were correct.
The advantage of having these custom cables made - I could specify the length - so I made the cable 80mm, just about long enough for most small robots, but less than half the dfrobot one (which I think is about 200mm)

Microcontroller and firmware

After some messing around, I decided to use the Attiny4 microcontroller - it is the smallest and weakest AVR microcontroller, and one of the smallest ones generally available. It is in a sot-23-6 package, which is just-about hand-solderable, and has an amazing 4 gpio pins.

I did a couple of tricks -
  • The internal oscillator on these microcontrollers is not perfectly accurate, so we can't measure 1500 microseconds reliably. So based on an idea from Scott (thanks Scott!) - I simply auto-calibrate when receiving the first pulse after power on.
  • The input signal pin - I have used the "reset" pin for the input signal - which has an advantage that it's tolerant of up to 12 volts, as the 12v is used for "high voltage programming mode" 

 

The Attiny4 can be programmed using a Arduino with the ArduinoISP firmware. After the RSTDISABLE fuse is blow, then it can only be reprorgrammed by putting 12v into the reset pin. I haven't yet found a way to reset the fuse (but I think it's possible).


The firmware is about 250 lines and compiles to 362 bytes (the Attiny4 has 512 bytes of flash)


Development pictures

 

 
 An early layout attempt - which didn't actually fit.

 

Doing a fit test on the PCB minus components




A panel made by JLCPCB for the prototypes. I had them assemble some of the trickier components and put the microcontroller and connector on by myself.





 A home made prototype - similar to the production version, but not quite so red 


 


Dogfood-robot with red on one side and dfrobot on the other


Some assembled panels







No comments: