Posts Tagged ‘ Arduino ’

Global constructor bug in GCC 4.5.1

I’ve recently returned to programming my Seeeduino Mega (ATmega1280) for my tricopter. Yesterday I discovered that every time I included serial code in the sketch, the sketch seemed to freeze as if it was not running the loop(). After several hours, I identified the source of the bug to be in the gcc-avr compiler that Linux uses. Note that this bug does not affect the ATmega328p of the Duemilanove.

I am compiling and uploading sketches from the command line (another small adventure I will post about later) with Arduino 0018 on 64-bit Arch Linux.

This blog post explains the bug pretty well. Until an official patch comes out, there are two workarounds: downgrade to GCC 4.3.3 or make the proposed patch. I tried installing the 4.3.3 version from archived sources but ran into other bugs that did not let me compile.

This GCC Bugzilla report describes the patch with proper line numbers. After building the patched source and installing the package, I was able to compile and upload fully-functioning ATmega1280 sketches.

Here is the compiled package for 64-bit Arch Linux.

Advertisements

My first robot!

My first electronics project, for that matter. I am currently taking an electronics class at my high school, and as part of the course, we are required to order and build an electronics kit. Since the kits provided were, in my opinion, too easy for me, I decided to order my own parts and build a remote-controllable robot based around an Arduino. I will try to throw together a haphazard build log here.

My first task, I decided, was to design and build a DC motor driver capable of driving four motors. I designed the PCB using KiCAD (see the schematic here and the PCB here) and ordered it through BatchPCB.

I wanted an omnidirectional robot. Both to save cost and for the additional wow factor, I decided to make it three-wheeled (kiwi drive). It will be good experience for next year’s FIRST competition anyway.

The following is my bill of materials, including where I ordered the products and their prices. I ordered many extra parts from Digi-Key so I could get lower bulk prices. I ordered the USB cable because I had too few and the extra transwheel in case I messed up while drilling holes in them. As you can see, I also took advantage of samples offered by some companies. I actually ordered samples of accelerometers and many other components not listed here that I thought may be useful in the future. Extras are indicated by an asterisk.

STMicroelectronics – $0

  • 3x* L298HN motor drivers (sample)

Keystone Electronics – $0

  • 4x 2-terminal blocks (sample)
  • 2x* 3-terminal blocks (sample)

BatchPCB – $20.06

  • 1x Custom-made four-motor driver PCB

SparkFun Electronics – $24.75

  • 1x RF Link Transmitter – 315MHz
  • 1x RF Link 4800bps Receiver – 315MHz
  • 1x Resistor Kit – 1/4W
  • 1x Polarized Connectors – Crimp Pins
  • 1x Heatsink Compound – ST350

Pololu Robotics & Electronics – $77.41

  • 3x 35:1 Mini Metal Gearmotor
  • 2x Pololu Micro Metal Gearmotor Bracket Extended Pair
  • 2x Pololu Universal Aluminum Mounting Hub for 3mm Shaft Pair
  • 1x 0.100″ Breakaway Male Header: 1×40-Pin, Straight
  • 1x 0.1″ Crimp Connector Housing: 1×2-Pin 25-Pack

Kornylak Corporation – $15.20

  • 4x* FXA208B (2051-1/4BX) CAT-TRAK transwheels

Digi-Key – $18.90

  • 1x* USB A-B (Q361-ND)
  • 10x* CAP 470UF 50V ALUM LYTIC RADIAL (P5185-ND)
  • 10x* CAP CER .1UF 100V X7R 0603 (490-3285-1-ND)
  • 18x* DIODE SCHOTTKY 60V 2A SMA (497-2461-1-ND)
  • 50x* RES 270 OHM 1/10W 1% 0603 SMD (311-270HRCT-ND)
  • 10x* LED GREEN CLEAR 1206 SMD (160-1404-1-ND)
  • 10x* LED SUPER RED CLEAR 1206 SMD (160-1405-1-ND)

Subtotal: $156.32
Total S/H: $18.39
Total: $174.71

All orders except those from BatchPCB and SparkFun have arrived. I will elaborate in the next post.

Advertisements