• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Whenever you search in PBworks or on the Web, Dokkio Sidebar (from the makers of PBworks) will run the same search in your Drive, Dropbox, OneDrive, Gmail, Slack, and browsed web pages. Now you can find what you're looking for wherever it lives. Try Dokkio Sidebar for free.



Page history last edited by Zonker Harris 6 years, 5 months ago

Adding Arduino to your Micropolis Module



(Introduction to Arduino for LEGO presentation, Bricks by the Bay 2014)


Adding 5 volt power under our modules will make it easy to add LEDs for lighting, special-function LEDs (flickering flame, blinking, etc.), and even power small motors for movement.


In the most simple method, a single rectifier diode can drop the 5 volt supply down to 4.4 volts. White and blue LEDs like to operate at 4.5 volts, so this is sufficient. You could get away without current limiting resistors, which would simplify wiring. 


(How to figure out which resistor to use)


You can do so much more in your module, if you embed a small microcontroller, such as an Arduino. There are many small versions now, depending on how many LEDs you want to control at once. Remember to buy a version that can take 5-volts as power in. If you want to drive LEDs, you probably want to make sure your version is 5-volt outputs, not 3.3-volt (the 5-volt chips often can source more current).



In order to power an embedded controller, select one that uses 5-volt power. You can power that processor from the power feed, and still add a diode to drop the power for any LEDs that you want to run all the time.


The processor can then turn other LEDs on or off (or even dim and brighten) under program control, including using sensors or switches so you can manually control some features of the program.


Some processors are very small, but only have a few outputs, perfect for simple automation. Other processors are a bit bigger, and can do much more. I suggest that you consider using a simple socket on the module, and get a processor with most (at least many) pins on one side of the board, so that you can easily swap the processor.



I'm going to add a row of 90-degree pins to one side of an Arduino Pro Mini, to give me 8 I/O pins (4 are PWM output). This will let me easily swap the processor later if I have a hardware failure. (Even at a show, without a soldering iron or other tools.) The FTDI programming pins will let me reprogram the board while it's still installed under the module.


If you only need a few pins, the AT-Tiny family are as small as 8 pins, and can fit on the head of a 2x2 brick!




I'll be mounting the controller to the module, using a 10-pin molex connector, Kragle'd to a 2x2 inverted tile (LEGO Part 11203), which will anchor the connector under the top plate of the module. The Arduino can then slide into the connector, or be removed for programming. The wires for power will be stable, and not tugging on the circuit board. The wires to the LEDs will also be stable, and not tugging on the wires and LEDs inside/on the module.   


If you are new to Arduino, you can read more on arduino.cc, and I suggest you try looking at the Example code samples, to see how easy it is to read. (I've posted a version of my code for the Bus Barn.)


If you haven't any background in programming or electronics, I encourage you to consider starting with an ARDX kit, which includes educational instructions. They are a bit pricey, because they have an Arduino and all the parts you need to see much of what the Arduino can do. Different vendors make these kits, and prices vary, because each vendor adds a few extra parts and projects to the basic ARDX projects.

(Adafruit, Sparkfun, Tiny-Circuits, and check out the tutorials by Jeremy Blum.)


Most of the good vendors have forums or "learning" sections. These are also good places to find out "hot to" do particular things, and look for inspiration. Other people have likely built something similar before you, so you don't need to invent the wheel.


Comments (0)

You don't have permission to comment on this page.