The Blog

Arduino PWM Shield Icicle Lights Prototype

It's getting close to that time of year again. Time to put up Christmas lights. This year I kind of wanted to go a little overboard and have all the lights RGB and Arduino controlled. What I've come up with is a project that's going to use a PWM Shield, RTC, and Wifi/Xbee shield.

Why do I need all that hardware to control lowly Christmas lights? I really want to be able to have some cool effects run, as well as have them turn on and off automatically. As a kicker I also want to be able to control them via my phone (I will admit that's a bit overkill), but the end result is going to be pretty cool.

Click For Larger Image

The main shield behind this project is the PWM Shield. It's basically a shield that has two TLC5940's daisy chained together. For the project I'll be using two (each shield can be daisy chained to another shield using a simple jumper wire).

In the photo above you can see that I've hooked up the RGB LED's to the shield. Each LED required 3 channels and each one is hooked up in order. ie. Channel 0 = Red, Channel 1 = Green, Channel 2 = Blue, Channel 4 = Red etc.

Click For Larger Image

Above you can see a shot of the prototype. I've only got 6 lights hooked up (because I need more jumper wires as they make nice sockets for the led's); however, adding more led's is simply a matter of changing one int within the code.

Video

Next Steps

Sometime in the near future I'm going to finish the string and add in a RTC and either a Wifi or Xbee shield (not sure about the wifi because their shield may use some of the pins that the PWM shield uses). Once that's done I'll make a little webapp so I can control everything from my phone (which of course I'll release :-) ).

If you have any questions, comments or suggestions I'm all ears. I'd love to hear some ideas for sequences.

 

The Code:

#include "Tlc5940.h" int green; int blue; int red; boolean flipflop = true; int num_rgb = 6; int num_channels = (num_rgb * 3) - 1; int maxbrightness = 1000; int seq1_red = 1000; int seq1_green = 0; int seq1_blue = 50; int seq2_red = 0; int seq2_green = 1000; int seq2_blue = 0; /* Red = 1 Green = 2 Blue = 3 */ int fadein_color = 1; int fadeout_color = 2; int color_min = 0; int color_max = 1000; void setup() { /*You can optionally pass an initial PWM value (0 - 4095) for all channels.*/ Tlc.init(0); Serial.begin(9600); } void loop() { for(int i=0; i<10; i++){ blink_alternate(); } for(int i=0; i<4;i++){ fade_through_flipflop(); } for(int i=0; i<4;i++){ fade_through(); } } void blink_alternate(){ Tlc.clear(); if(flipflop == true){ for(int i=1; i<=num_rgb; i++){ red = (i * 3) - 3; green = (i* 3) - 2; blue = (i * 3) - 1; if(i % 2){ Tlc.set(green, seq1_green); Tlc.set(blue, seq1_blue); Tlc.set(red, seq1_red); }else{ Tlc.set(green, seq2_green); Tlc.set(blue, seq2_blue); Tlc.set(red, seq2_red); } } flipflop = false; }else{ for(int i=1; i<=num_rgb; i++){ red = (i * 3) - 3; green = (i* 3) - 2; blue = (i * 3) - 1; if(i % 2){ Tlc.set(green, seq2_green); Tlc.set(blue, seq2_blue); Tlc.set(red, seq2_red); }else{ Tlc.set(green, seq1_green); Tlc.set(blue, seq1_blue); Tlc.set(red, seq1_red); } } flipflop = true; } Tlc.update(); delay(1000); } void fade_through_flipflop(){ Tlc.clear(); if(flipflop == true){ for(int j=0; j<=maxbrightness; j++){ for(int i=1; i<=num_rgb; i++){ red = (i * 3) - 3; green = (i* 3) - 2; blue = (i * 3) - 1; if(i % 2){ if(fadein_color == 1){ Tlc.set(red, color_min + j); }else if(fadein_color == 2){ Tlc.set(green, color_min + j); }else if(fadein_color == 3){ Tlc.set(blue, color_min + j); } if(fadeout_color == 1){ Tlc.set(red, color_max - j); }else if(fadeout_color == 2){ Tlc.set(green, color_max - j); }else if(fadeout_color == 3){ Tlc.set(blue, color_max - j); } }else{ if(fadeout_color == 1){ Tlc.set(red, color_min + j); }else if(fadeout_color == 2){ Tlc.set(green, color_min + j); }else if(fadeout_color == 3){ Tlc.set(blue, color_min + j); } if(fadein_color == 1){ Tlc.set(red, color_max - j); }else if(fadein_color == 2){ Tlc.set(green, color_max - j); }else if(fadein_color == 3){ Tlc.set(blue, color_max - j); } } } delay(10); Tlc.update(); } flipflop = false; }else{ for(int j=maxbrightness; j>=0; j--){ for(int i=1; i<=num_rgb; i++){ red = (i * 3) - 3; green = (i* 3) - 2; blue = (i * 3) - 1; if(i % 2){ if(fadein_color == 1){ Tlc.set(red, color_min + j); }else if(fadein_color == 2){ Tlc.set(green, color_min + j); }else if(fadein_color == 3){ Tlc.set(blue, color_min + j); } if(fadeout_color == 1){ Tlc.set(red, color_max - j); }else if(fadeout_color == 2){ Tlc.set(green, color_max - j); }else if(fadeout_color == 3){ Tlc.set(blue, color_max - j); } }else{ if(fadeout_color == 1){ Tlc.set(red, color_min + j); }else if(fadeout_color == 2){ Tlc.set(green, color_min + j); }else if(fadeout_color == 3){ Tlc.set(blue, color_min + j); } if(fadein_color == 1){ Tlc.set(red, color_max - j); }else if(fadein_color == 2){ Tlc.set(green, color_max - j); }else if(fadein_color == 3){ Tlc.set(blue, color_max - j); } } } delay(10); Tlc.update(); } flipflop = true; } } void fade_through(){ Tlc.clear(); if(flipflop == true){ for(int j=0; j<=maxbrightness; j++){ for(int i=1; i<=num_rgb; i++){ red = (i * 3) - 3; green = (i* 3) - 2; blue = (i * 3) - 1; if(fadein_color == 1){ Tlc.set(red, color_min + j); }else if(fadein_color == 2){ Tlc.set(green, color_min + j); }else if(fadein_color == 3){ Tlc.set(blue, color_min + j); } if(fadeout_color == 1){ Tlc.set(red, color_max - j); }else if(fadeout_color == 2){ Tlc.set(green, color_max - j); }else if(fadeout_color == 3){ Tlc.set(blue, color_max - j); } } delay(10); Tlc.update(); } flipflop = false; }else{ for(int j=maxbrightness; j>=0; j--){ for(int i=1; i<=num_rgb; i++){ red = (i * 3) - 3; green = (i* 3) - 2; blue = (i * 3) - 1; if(fadein_color == 1){ Tlc.set(red, color_min + j); }else if(fadein_color == 2){ Tlc.set(green, color_min + j); }else if(fadein_color == 3){ Tlc.set(blue, color_min + j); } if(fadeout_color == 1){ Tlc.set(red, color_max - j); }else if(fadeout_color == 2){ Tlc.set(green, color_max - j); }else if(fadeout_color == 3){ Tlc.set(blue, color_max - j); } } delay(10); Tlc.update(); } flipflop = true; } }

Maker to Makerpreneur - Part 1

The other day I had a wonderful idea. Wouldn't it be great to write a series chronicling my own experiences with turning things I've made into a nice little side business? With the maker movement gaining more momentum all the time wouldn't it be great to have a resource you could turn to where you could learn how to turn something you love into something you love and can make money from?

My Background

I'm a PHP programmer (mostly) although I've always been very interested in electronics. Ever since I was young I've been taking things apart to figure out how they worked (when I was young it was more a case of breaking them). I discovered Arduino a little over a year ago. I actually stumbled across it (via stumbleupon). I was immediately hooked.

After doing the basic Arduino code I started to find things around the house that could be improved using an Arduino. Number one on my list was my aquarium. It had so many little things that needed to be measured/controlled. Since there were no shields that did what I wanted to do I learned eagle and designed my first circuit boards.

They weren't very pretty, but they did work and I learned some things along the way. After posting in the Arduino forum (and on my website) about what I was doing I had people inquire as to whether I was selling any... and overnight I turned into a Makerpreneur.

Although we moved recently you can see my Maker space in the photo on the left. It's not a big space, but I've been able to successfully prototype 5 shields that filled a need that I had.

The First Rule

The first rule is don't start building something for somebody else. If you're serious about becoming a Makerpreneur make something that fills a need in your life first. For me that was controlling my aquarium.

By finding something that fills that need you can be sure that you'll be able to draw on the passion you have for fixing that problem. When I started I had no idea how to route a circuit board, but I learned because I really wanted to fix my problem.

That's what the maker movement is all about really. You find a need that you have and fill it with something you make. You can guarantee that there are more than a thousand people with that same need that you have.

Which is where the business can come in.

The Key To Success

One of the worries that comes up is somebody is going to steal my idea and profit for themselves. I don't really think that's true anymore. Those in the open source world care a lot about attribution (myself included) and I have yet to see someone release my designs as their own.

The whole key to getting people to notice you is to contribute. If you want somebody to look at your widget than post on a forum what you're doing. Ask for feedback and get others involved. If someone has a problem that you know how to solve than help them solve it (@jcrouchley has helped me countless times).

On top of that make sure you have your own website/blog. When you're starting up don't worry about having a store on it, just worry about posting what you're doing. This generates interest and also valuable feedback (my commenters have left me amazing ideas).

Do Something and Don't Worry What Others Think

Before I wrap up this post up there's one more nugget. Even if you have mistakes in what you've made go ahead and make it and show it to people. When I started I was chastised a little bit because it seemed I had no idea what I was doing (and there were mistakes). Ignore those people and listen only to the ones who give you valuable feedback (I find in the open source world many are willing to help the clueless... as long as it isn't something you couldn't find on Google).

 

Make sure to keep checking back for new posts in the series. I'll be discussing everything from how to come up with design ideas all the way to promoting, selling, shipping, ecommerce and a slew of other topics.

Stay tuned!

Arduino 'Bonjour Like' Library

A lot of the projects that I'm currently working on I want to have a mobile phone (or computer) interface for. The aquarium project, as well as the home automation shields and environmental shields I'm working on are all connected via ethernet or wifi. My problem was I kind of wanted to just deploy them with a generic sketch and do configuration from the phone or computer.

The Idea

The phone app could query my LAN with a string and when any arduino receives it the arduino could reply with capabilities.

ie.

  • In app settings put 192.168.0 for your network
  • phone sends out requests to 192.168.0.1 to 192.168.0.255 with string 'ARDUINOACK'
  • If device is arduino it replies 'ARDUINOACK'
  • Device IP is store into database

Once the arduino receives the 'ARDUINOACK' it subsequently replies with it's capabilities (and ip) in JSON format which the requesting app than stores in a database.

The result is you could deploy any number of arduino devices with a generic code base and remotely monitor/configure them.

Sample Algorithm

  • open app and input ip range 192.168.0
  • Click 'Find Devices'... phone sends requests with 'ARDUINOACK' with it's ip address to 192.168.0.1 to 192.168.0.255
  • Arduino replies with 'ARDUINOACK' with ip address
  • app sends 'REQUESTCAPABILITES' to found ip addresses
  • arduino returns JSON list of capabilities (includes number of devices as well)
  • Sample JSON string: {ip:192.168.0.100, location:unknown, ds1b820:3, photosensor:1, wifi:1, bnc:2, eeprom:1, sdcard:1,ds1307:1}
  • app stores arduinos ip address and capabilities
  • You give that arduino a name in the app
  • Open that arduino's settings and the page presented is based off the arduinos capabilites
  • ie. if it replied with {output:5} you could toggle output 3 to off (or set a timer, or on/off times)
  • ie. it replied with temp sensors attached and when you open settings it would show the temperature values.

I haven't really started on the arduino code; however, it will mostly be copied from my arduarium project and made a bit more modular.

The mobile apps are being made in phonegap (having to relearn javascript again) and there will be both android and iphone versions.

Cool Stuff

Here's just a sample of some of the cool stuff you could do.

  • deploy environmental station outside hooked up via wifi. Open your phone and add that arduino in and one of the screens would tell you what the weather is like outside.
  • deploy arduino with wifi and ac relays around your home. Add in the arduinos and program in location. After that you could control your entire homes devices with minimul setup.

The idea here is to develop one codebase for the arduino and one codebase for the app which could let you do 1001 things.

As an aside this could also work with an internet server as well. To start I'll be building it for my LAN, but it would be cool to be able to control things over the internet. It would simply be a matter of telling the arduino the ip address to report to.

Every 100th Order is Free and You Get a $100 Credit

I'm pleased to announce that every 100th order that Practical Maker ships is going to be free! In addition, the lucky winner will also get a $100 credit for a future order.

It doesn't matter what you order... if your order can be divided by 100 evenly you get it free AND you get a $100 credit at the site for a future order.

There is a maximum to how large the order can be. If your order is more than $250USD you'll get a credit on that order (and you can also apply the $100 credit as well).

Thanks so much for supporting me!

BNC Shield Demo

The new BNC (formerly called PHORPDuino Shield) is here! This revision has some very exciting changes. (The pic says V0.2, that's just because all the V0.3's are gone. Only difference is spacing added between some caps).

Key New Features

  1.  Analog input is pinned out. User can select via a jumper which analog input they wish to use.
  2. Added some buffering to make readings more stable. Previous versions jumped around a bit. That's fixed.
  3. Removed the second BNC connector (to add in buffering)
  4. MCP3204 is available (not standard). This adds in 12 bit readings
  5. 2 trim resistors for rough/fine tuning
  6. Added a reset button and reset jumpers
  7. LED's added to show power to the shield is working (TC1121 to ensure V+ and V- is working)

Without further ado, here's some pics:

And a video demonstrating the shield:

Arduino TLC5940 Shield Demo

At last... the shield I've been dying to get is here! Introducing the Arduino TLC5940 shield. It's got two TLC5040's for a total of 32 PWM outputs.

Without further ado, here's a picture of the shield:

 

 

Click For Larger Image

 

As well as a video demo:

 

 

 

This shield has a lot of possibilities. With 32 outputs stackable to however many you need (once I figure out how to provide enough power) the sky's the limit for your PWM dreams.

I personally designed the shield to be a sort of advanced aquarium lighting controller. Somebody suggested 'why not replicate lightning in the aquarium?' and the idea was born. It will consist of 32 strings of 3 luxeon led's. It should be quite interesting.

Key Points

  • 2 TLC5940's
  • 32 PWM outputs
  • Daisy chainable up to 640 outputs
  • User selectable current settings (20ma, 40ma, 80ma, 120ma)
  • Stackable (not the one in the picture or video because I didn't have any 90 degree headers, but with those on it's stackable)

 

DIY Labs is now Practical Maker

In this day and age it's near impossible to find a domain name that you like that isn't taken. I started out with diy-labs.com because it was pretty much all I could think of at the time.

Well, a couple days ago I stumbled upon practicalmaker.com and felt it was the perfect name to represent my goals as a maker.

Some of the projects may seem outlandish, but they all serve a practical purpose in one way or another.

I hope you like the new name. Let me know if you do!

TLC5940 Shield, BNC Shield and I2C LCD/Keypad Controller

I haven't really been updating the website lately, but I've still been working on some cool things. The fruit of that labor is some new shields, an updated shield and a board based on @jcrouchley LCD/Keypad controller.

TLC5940 Shield

The TLC5940 shield is exactly that. It's got two TLC5940's onboard giving you a total of 32 PWM pins. The cool thing about this shield is you can stack (a lot) of them on top of each other because SIN and SOUT are pinned out. All that's needed to add a second shield in is a jumper wire from the first shield to the second.

 

BNC Shield

Initially I changed the pHDuino shield into something that fit more with what I wanted... ORP and pH on one shield. The only problem was it was very sensitive to power supply fluctuations. I've taken the second BNC connector off and added some more buffering as well as a 12 bit ADC (for future use). After more than a month of testing it's never been off by more than 0.5 from a calibrated pH monitor. The great thing is this shield will also work with an ORP probe and any sensor that produces minute voltages and has a BNC connector (no EC though)

 

I2C LCD/Keypad Controller

I was lamenting on twitter about how there was no open source lcd/keypad controller. Well @jcrouchley heard me and designed one. I've taken his schematic and put it on a pcb and am working on a library. The best part? It's based on the attiny2313 and should cost around $10 or so.

 

EC Shield

Many people email me and ask when the EC shield is going to be done. Well, it's getting close. I've got the schematic drawn up and am waiting for some parts so I can breadboard it. After some testing I'll get some boards done and release it.

 

I think that's it for now. If you have any questions you can send me a message on twitter or contact me using the contact form.

Arduino Shield Design Standards

V0.3

It seems like I'm not the only one who has run into problems with Arduino shields holding me back from doing projects. Here we're going to discuss a standard for designing Arduino shields which should make the whole system much more modular and open up new realms of possibilities for the Arduino.

The idea is simple. When designing a shield you have certain pins that you can use and your shield must allow the user to be able to change them.

Definitions:

User Selectable Input: If your shield uses analog inputs these pins should have jumpers/solder pads so the user can pick which input to use.

 

The following table are the guidelines for pin assignments when designing a shield.

  

Pin Reserved For
   
Analog 0 User Selectable Input
Analog 1 User Selectable Input
Analog 2 User Selectable Input
Analog 3 User Selectable Input
Analog 4 I2C
Analog 5 I2C
   
Digital 0 RX
Digital 1 TX
Digital 2 Onewire
Digital 3 PWM / Digital I/O / I2C Interrupt
Digital 4 CS Select
Digital 5 PWM / Digital I/O
Digital 6 PWM / Digital I/O
Digital 7 CS Select
Digital 8 CS Select
Digital 9 PWM / Digital I/O
Digital 10 PWM / Digital I/O
Digital 11 SPI
Digital 12 SPI
Digital 13 SPI

 

Power

Suggested By: Anonymous

Power should not be taken from the ICSP header as if you have two shields that do that you simply cannot make them work.

Shield Silkscreen

Suggested By: Josiah Ritchie

By this I don't mean providing a PDF, but rather having useful information printed on the silkscreen of the PCB. For example, the Arduino clearly identifies which pins are used for what.

I propose:

All pins should have clear markings as to what their function is. In addition, replace R1,C1 etc. with the actual value of the component (through hole boards for sure as it makes putting them together a breeze).

An example PCB layout:

 

 

I2C

Analog Pins: 4, 5

If at all possible your shield should use I2C as the communication protocol (if there's a similar IC that supports the protocol). The reason for this is that with I2C we can hook up a large number of shields and only use analog pins 4 and 5. If your device has address pins they should be pinned (or have jumper pads) out so the user can configure the address as well. If your shield uses the analog inputs try not to use pins 4 or 5 so they can be used for I2C.

Interrupts

Suggested By: Gary Muhonen

If the IC has an interrupt line it should be pinned out and be user selectable by adding a jumper to pin 3 (opinions?)

SPI

Digital Pins: 11, 12, 13

Jumper Pins (Digital) (CS): 4, 7, 8

If you must use SPI as the protocol for your shield the CS pin must be selectable. If designing a shield with an SPI device on it the CS pin must be selectable. Pins 4, 7, 8 should have jumpers so users can use up to 3 SPI shields with the arduino.

Onewire

Digital Pin: 2

Should your shield be using the Onewire protocol you should use pin 2.

Serial

Digital Pins: 0,1

Digital pins 0 and 1 are reserved for serial devices. If your shield uses serial we could look at incorporating pins so the user could do software serial (need more info since I haven't done this yet... does anyone know if this works?).

 

Pin Markings

If your shield has pins the silkscreen should have all the pin names easily legible. Pins include pinouts, but also address pins (such as I2C devices). If there's room it would be good to have what the pin is and what it's used for (not required though).

Prototyping Area

This is really up in the air. If your shield has the extra room and you can squeeze the components together tighter proto area is an added bonus because it expands what can be done with the shield (opinions)

Analog Inputs

If your shield uses the analog inputs they should be user selectable by a jumper or solder pad (at least 3 for maximum interoperability).

Shield Shape/Dimensions

 Suggested By: SiliconFarmer

All 4 sets of headers MUST be on your shield. In addition, you should also use the double high headers so shields can be stacked on top.

Your shield can be any size provided that all 4 sets of headers are on your shield (ie. Xbee shield only has 2 of the headers which is annoying.

As for stackability, there are simply some parts that are taller than the headers (ie. BNC connector). For now using a set of double high headers works, but there could be a better solution (opinions?)

As for dimensions, my opinion (and SiliconFarmers') is that a rectangular board is OK. This may change if I get more feedback about mounting holes.

Not Covered

Mounting Holes (opinions?)

It's nice to have them there, but I honestly only mount the Arduino and stack shields on top

 

Suggestions

If you would like to see this amended just leave a comment.

Arduarium Controller Gets New Code

 After what seems like forever (but has only been about a day) I've added in 300+ lines to the Arduarium Controller code. It's really starting to behave like an aquarium controller since I can now monitor PH.

I think one of the best new features of the code is the PH configuration. From what I've seen everybody has come up with a custom formula to calculate their PH. That's not required anymore. Simply open up the config menus and select 'Configure PH' and the instructions on the LCD will do the calibrating for you.

Another one of the new features in the code is the ability to set the time you want the lights to turn on and off. There's also an option to set how long (in hour) you want the lights to dim off and on. This simulates sunrise and sunset quite nicely. Although it's really only configured for LED lights right now it will be able to handle whatever lights you have.

Of course one of the things I wanted most was the ability to save all these configuration options to an eeprom. The power went out a couple weeks ago while we were out and the consequent reset wreaked havoc on the tank. All values are stored in an eeprom so this can't happen again (provided the eeprom doesn't die lol).

Anyways, you can check out there new code here

Comments and suggestions are welcome as they've been the guiding force in the design.

Pages