Minion City http://www.minioncity.com The Wireless Enabled Dev Board Wed, 27 Nov 2013 15:48:24 +0000 en-US hourly 1 We are now selling the Minions on our site! http://www.minioncity.com/2013/01/20/we-are-now-selling-the-minions-on-our-site/ http://www.minioncity.com/2013/01/20/we-are-now-selling-the-minions-on-our-site/#comments Sun, 20 Jan 2013 06:28:11 +0000 Nate http://www.minioncity.com/?p=236 Hey everyone,
We are now selling the minions through our site.

http://www.minioncity.com/shop/

We are using paypal to manage payments. You can purchase with a paypal account or without with a credit card.
We currently have over 100 minions in stock and ready to go.

]]>
http://www.minioncity.com/2013/01/20/we-are-now-selling-the-minions-on-our-site/feed/ 6
Updates and Design Files http://www.minioncity.com/2013/01/02/updates-and-design-files/ http://www.minioncity.com/2013/01/02/updates-and-design-files/#comments Wed, 02 Jan 2013 14:27:54 +0000 Nate http://www.minioncity.com/?p=204 I hope you all had a great holiday season. It was great to be able to have everything sent out before so we could enjoy some time off.
We are now back at it again and working on documentation and are also hopping to have the ability to buy additional minions set up here in the next week or so.

A google group has been started over at https://groups.google.com/d/forum/minioncity by Baruch. I’ll be watching there as questions come up as well as comments to the blog.

So first off here is the schematic of the minions.
There are a few key differences from the normal arduino.
First off is the lack of an led on pin 13. Routing was getting a little tight so removed it. The two LEDS on the board are tied to TX and RX. Which is why you see them blink when downloading your code.

The second is the radio. It uses 5 lines to talk to the processor.

  • MOSI
  • MISO
  • SCK
  • D3
  • D10

MOSI,MISO and SCK are part of the spi bus and are not part of the numbered ports in arduino. As a side note if you want to reprogram the processors bootloader you need a pullup resister on D10. D10 is the select line on the radio. The RF12 library uses an internal pullup resister to do the job but when you are resetting the processor to burn in a bootloader it is released and causes problems with the programmer. The battery shield added a 10k resister for programming.

D3 and D10 are part of the normal pins and shouldn’t be used when you are using the radio.

The eagle files for the main board and the battery shield are available at

http://www.minioncity.com/download/

(Schematics and board layout)

]]>
http://www.minioncity.com/2013/01/02/updates-and-design-files/feed/ 13
Minion Christmas Lights http://www.minioncity.com/2012/10/19/minion-christmas-lights/ http://www.minioncity.com/2012/10/19/minion-christmas-lights/#comments Fri, 19 Oct 2012 16:36:47 +0000 Jake http://www.minioncity.com/?p=158 MINION CHRISTMAS LIGHTS

Christmas is fast approaching and we, like many of you, want to have a hacker style Christmas. We want to be able to have full control over our Christmas lights this year. GE lights are one of the best ways to do this because they have such huge capability. The out of the box the lights though only have a few sub par light functions programmed in.

We needed a way to hack into the lights and gain control. So we developed a small Arduino based unit that would fit in the original box of the GE light string, we call this little guy Minion. Minion is currently available on kickstarter until Nov 1st, check it out: http://www.kickstarter.com/projects/2039452711/minion-the-wireless-enabled-dev-board (back this project now and get it in time for Christmas).

With Minion you can communicate with any bulb on any string and make it any color you want at anytime. This creates an easy method to make your house Christmas lights dance to music, spell sayings, make shapes and designs, etc.

Here’s a brief project overview and then a demonstration. More details are after the videos.

The First step was to open the GE light circuit box. They have a goofy triangle screw, you can use a small straight edge bit if you’re careful, others have ground hex keys down to fit. Once you get the box open you’ll have to pry the epoxy free form the housing.

 The next step is to do a little custom fabrication on the GE box. You’ll need to break off all the plastic pieces that stick out into the empty cavity of the box. This will allow Minion to fit nicely inside the box.

We used a small blow torch to heat up an X-Acto knife. This made the knife cut through the plastic like butter and gave us smoother edges inside the box.
 After that, you’ll need to take disconnect the original GE circuit board from the wires. We used a soldering iron and just re-flowed the solder.
 Now connect the Minion up to the power, the ground, and the signal line from the GE light string. Take note which signal line you connect it too. You’ll need to make sure that the power and ground get connected to the Minion from the wall wart as well. This will allow for the Minion and the lights to be powered from the wall wart.
Put a healthy coat of hot glue on the board to keep it safe from having the connections pulled while assembling. Hot Glue is a great insulator and has the benefit of holding the wires tight as well. We put a piece of cardboard under the wires and glued them all to it to hold them steady.
(We used our proto Minions that all had headers on them. So this was a proof of concept. Once we get our final Minions, which will not have headers already installed, I am going to just wire them straight into the board.)

Because we removed the inner plastic pieces as we showed above Minion fit in perfectly. We took the antenna and wrapped it around the board so that the entire Minion was completely contained in the controller box. Finally replace the box lid and screws. The end goal is to make it all watertight again.
Now to the code. We used the G35Arduino to control the lights and the RFM12 Library for controlling the radio.
The G35Arduino library is a great library for controlling the GE lights. It takes care of all the communication and timing. It lets us take control of all the lights. With it we can turn on a section of the light or just a single bulb. It lets you change the color and the brightness of each bulb. It also has examples light programs in it to help get you started.  The library is available at: https://github.com/sowbug/G35Arduino


The 2 main ideas for using these are
             1: A predefined (recorded) light show: The Minions sync together and do their thing without receiving signals from a computer after being programmed. This is the final goal for us.
             2: Control the lights live from a computer: This is easier to set up and a first step to getting to the predefined show.


These instructions are for the live light show from a computer. It is the fastest way to get these lights up and working and later we will do the predefined (recorded) show.


For the Master Minion (the Minion sending the signal commands from the computer) we used the Minion Chat program. This is from our first test with the Minion, it is a simple way to send data straight from the terminal. The Chat program waits for you to send a byte through the COM port and then broadcasts it out to a specific Minion. We did this because we could just type on the keyboard and have it sent to the Light Minion. No Gui needed. (Code available below)


When the Light Strand Minion starts up it initializes all of the lights. This is taken care of by the library and gives all the lights a number. My strand here has 25 lights so it numbers them 0-24.


To make changing the lights quick and easy we had the Light Minion listen for characters sent over the radio. 0-9 set the color that we want the bulb to be.

0: BLACK
1: WHITE
2: RED
3: BLUE
4: GREEN
5: CYAN
6: MAGENTA
7: YELLOW
8: PURPLE
9: ORANGE

Because my strand has 25 lights I mapped the lights to  q=0 w=1 e=2 etc. (The layout of the letters on the keyboard. The first row of letters was 0-9, 2nd 10-18 and 3rd 19-24)


So by typing 2qwert into the terminal we could turn the lights 0-4 to red. 0qwert would then turn them to Black or Off.


If you have any questions about hacking GE lights with Minion or Minion at all please email leave them in the comments and I will get to you. Either by email or a reply in the comments.


Don’t forget to check out our kickstarter for these Minion circuits. It runs until Nov 1st, order them now to get them in time for Christmas. http://www.kickstarter.com/projects/2039452711/minion-the-wireless-enabled-dev-board


All the code is below.

MinionLight Code

#include         //Radio Library
#define myNodeID 30 //node ID of Rx (range 0-30)
#define network 210 //network group (can be in the range 1-250).
#define freq RF12_915MHZ //Freq of RF12B can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. Match freq to module
typedef struct { byte c1 ;} Payload; // create structure - a neat way of packaging data for RF comms
Payload rxPacket;
const int Rx_NodeID=10; //emonTx node ID

//G35
#include
#define LIGHT_COUNT (25)
#define G35_PIN (4)
G35String lights(G35_PIN, LIGHT_COUNT);
//EO G35

void setup() {
lights.enumerate();
lights.enumerate();
Serial.begin(115200);
lights.fill_color(0, LIGHT_COUNT, G35::MAX_INTENSITY, COLOR_WHITE);
rf12_initialize(myNodeID,freq,network); //Initialize RFM12 with settings defined above
}

int Color=0;
int BulbNum=0;

void loop() {
if (rf12_recvDone())
{
if (rf12_crc == 0 && (rf12_hdr & RF12_HDR_CTL) == 0)
{
int node_id = (rf12_hdr & 0x1F); //extract nodeID from payload
if (node_id == Rx_NodeID)
{ //check data is coming from node with the corrct ID
rxPacket=*(Payload*) rf12_data; // Extract the data from the payload
char temp=(char)rxPacket.c1;
Serial.print(temp);

if(temp=='q') BulbNum=0;
if(temp=='w') BulbNum=1;
if(temp=='e') BulbNum=2;
if(temp=='r') BulbNum=3;
if(temp=='t') BulbNum=4;
if(temp=='y') BulbNum=5;
if(temp=='u') BulbNum=6;
if(temp=='i') BulbNum=7;
if(temp=='o') BulbNum=8;
if(temp=='p') BulbNum=9;
if(temp=='a') BulbNum=10;
if(temp=='s') BulbNum=11;
if(temp=='d') BulbNum=12;
if(temp=='f') BulbNum=13;
if(temp=='g') BulbNum=14;
if(temp=='h') BulbNum=15;
if(temp=='j') BulbNum=16;
if(temp=='k') BulbNum=17;
if(temp=='l') BulbNum=18;
if(temp=='z') BulbNum=19;
if(temp=='x') BulbNum=20;
if(temp=='c') BulbNum=21;
if(temp=='v') BulbNum=22;
if(temp=='b') BulbNum=23;
if(temp=='n') BulbNum=24;

if(temp=='0') Color=0;
if(temp=='1') Color=1;
if(temp=='2') Color=2;
if(temp=='3') Color=3;
if(temp=='4') Color=4;
if(temp=='5') Color=5;
if(temp=='6') Color=6;
if(temp=='7') Color=7;
if(temp=='8') Color=8;
if(temp=='9') Color=9;

if(temp>='a' && temp<='z')
{
switch(Color)
{
case 0: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_BLACK); break;
case 1: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_WHITE); break;
case 2: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_RED); break;
case 3: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_BLUE); break;
case 4: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_GREEN); break;
case 5: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_CYAN); break;
case 6: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_MAGENTA); break;
case 7: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_YELLOW); break;
case 8: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_PURPLE); break;
case 9: lights.fill_color(BulbNum, 1, G35::MAX_INTENSITY, COLOR_ORANGE); break;
default: break;
}
//If you have the USB connected you can watch the commands come in for debugging
Serial.print("Color: ");
Serial.print(Color);
Serial.print("Bulb: ");
Serial.print(BulbNum);
Serial.print("char: ");
Serial.println(temp);
}

}
}
}

}//end of void LOOP()

Minion Chat Program Code (Minion Master attached to the computer)

#include

#define myNodeID 10 //node ID of Rx (range 0-30)
#define network 210 //network group (can be in the range 1-250).
#define freq RF12_915MHZ //Freq of RF12B can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. Match freq to module

typedef struct { byte c1 ; } Payload; // create structure - a neat way of packaging data for RF comms
Payload txPacket;

const int Rx_NodeID=0; //emonTx node ID

void setup() {

 Serial.begin(115200);
 while (!Serial);
 rf12_initialize(myNodeID,freq,network); //Initialize RFM12 with settings defined above
 }

void loop() {

 if(Serial.available()>0)
 {
   if(rf12_canSend())
   {
   txPacket.c1=Serial.read();
   int i=0;
   while(!rf12_canSend() && i<10)
   {
     rf12_recvDone();
     i++;
   }
   rf12_sendStart(0,&txPacket,sizeof txPacket);
   }
 }

}//end of void LOOP()

]]>
http://www.minioncity.com/2012/10/19/minion-christmas-lights/feed/ 3
DIY Animatronic Pumpkins or Fondly Know As Jack-O and The Lanterns http://www.minioncity.com/2012/10/14/diy-animatronic-pumpkins-or-fondly-know-as-jack-o-and-the-lanterns/ http://www.minioncity.com/2012/10/14/diy-animatronic-pumpkins-or-fondly-know-as-jack-o-and-the-lanterns/#comments Sun, 14 Oct 2012 05:52:00 +0000 Nate http://www.minioncity.com/?p=127

It all started one dark night when we had a thought, why settle for a lifeless jack o lantern this Halloween, why not blow the neighborhood kids away. So we set out to create a Jack O Lantern with a soul!!! Ok really it is just some pumpkins we can programmed to lip sync, mouth or mimic poetry but it is a whole lot of fun still the same. We used a dev board we developed called Minion to make these pumpkins come to life and be completely mobile. (Minion is our Kickstarter project, check it out here http://www.kickstarter.com/projects/minioncity/minion-the-wireless-enabled-dev-board) We also built some nifty software to bring it all together. The tutorial is below but first here is Jack-O and The Lanterns in action!

Ghostbusters

Witch Doctor

Thriller

Would You Go With Me

So what do you need to replicate the project. Here is a list of supplies

3 Funkins (we opted for fake pumpkins so we could reuse them next year)
4 Minion Dev Boards or Wireless radio boards
3 Battery packs
3 Servos
1 Wire Hanger
3 Small perf boards
5v regulators for powering the servos.
GE Color Effect Lights

We started by carving our faces into the three Funkins (yes that is the real brand name of the fake pumkins we bought). The type of face you carve is totally up to you but the simpler the mouth shape we found the better it works. Be careful to keep the mouth cut out all in once piece.

After the shell of Jack Os are created it is time to create the framework for their motion.  The servos that we used were ones that we had around from some RC airplane projects. They were 2 or 3 bucks and only have 1.6 kg of tourge. So in other words quick and not super big. If you use a real pumpkin you will probably need beefier servos. We then attached a piece of bent wire (from the wire hanger) to each servo to act as the radial arm opening and closing the mouth. We then calibrated over the range of motion for each pumpkin with just the wire arm. Because of the shape of the pumpkins it was impossible to have each mouth at the exact same angles and servo positions for open and close. Some would open up 50-60 degrees and others only would open up 30-40 degrees. To resolve this we made the software send a 0-100 percent and the minion code in the pumpkins scale it to the range needed for each pumpkin range. For more information on calibrating the open and close positions see near the end.

We hot glued the servo to the inside face of the pumpkin and hot glued a piece of cardboard to the radial arm and then glued it to the mouth piece of the pumpkin. We found that if we glued a piece of cardboard to the mouth piece it added more range of motion kicking the bottom of the jaw out just enough. It also made the mouth less rigid so there was some give if the mouth closed too quickly.

To power up the minion we just needed any power source because it has it’s own power regulator to drop it down to the 3.3v that the minion runs on. The servos and the GE Lights that we used needed 5v for power but the control signal would take 3.3v just fine. So using a cheap small perf board we created a 5v regulator (LM7805) and a connector for the servo and GE Light. Because the spacing of the minion headers match the .1” spacing of both breadboards and perf boards it was quick to make a circuit for the power that the minion just plugged into.

After attaching the battery pack and connecting the Minion we were set to go. Minion was the board that gave us the capability to tell the servos and Lights what to do. We used 4 Minions to control 3 separate pumpkins. One minion was the master and connected to the computer with its USB connector. It took the commands from the computer software and sent them to the other 3 Minions that were inside of the pumpkins. The best part is because the Minion attached to the computer wirelessly transmits data over its own radio we essentially have unlimited storage for the amount of programed actions we want to run because it is storing the data on the computer. The Minions allowed us to make the pumpkins completely wireless, this only made them look even cooler because they can now be placed inside, outside, on the shelf, on the roof, just about anywhere.

Now it is time to send data and bring these guys to life. We played with a lot of ideas on how to get their mouths to move but in the end we decided we want more control to be able to make it more life like. Coding each position by hand seemed like a nightmare to us so we wrote a piece of software to help make recording and playback simple and quick. Using a USB joystick or gamepad the software maps the y-axis to the mouth of the pumpkin in time and creates a file that maps it in time with an audio file. One of the buttons turns the light on and off. The software then is used to play the audio and motions so when you play it back you get lip syncing Jack Os.  Not only is it fun to record but it makes for a great karaoke night extra. For a more detailed description of the software see below. (source code is included)

Software:
PC Software
The pc side software is written with Visual Studio 2010 in C#. The source is below in the downloads section.
We used the SlimDX utility to make reading of joysticks and gamepads simple and easy. Without it they are painful to work with in C#. Why C#? mainly because I made development quick. (The software was written on a saturday, the same Saturday that we made all the pumpkins too).
The software has 2 parts. The first part is recording and the 2nd part is playing back.
The recording screen is shown below.
First you need to make sure that you are connected to the master Minion. The com port will be different on your computer but the baudrate is set to what the Minion master code is set at.
Then you need to load an audio file. UPDATE: It now can also play video files, or any files that windows media player recognizes.
Then you need to either load a mmf (Minion Motion File) or create a new one. A new mmf starts out with only 1 minion. The “Add Minion” button will let you add more minions.
If you are all set and ready to record, hit the play button and start moving the joystick. The Minion Pumpkin will move with the joystick so you can see it as you record. Straight up is closed and all the way forward is open.
The software takes a reading from the joystick 10 times a second. If that reading is different from the last reading it records the position (0-100), the time in the music (to the nearest 1/10 of second) and which Minion is currently selected in the drop down.
If you don’t like how it looked (it takes awhile to get use to the motion and be ready for the parts in the music) you can click the “Clear Minion” button. This button deletes all motion for the selected Minion.
Once you have recorded a section, hit stop or pause and click on the play tab.

In the play tab you can either load a mmf to play back with the “Open Motion File” button or if you just came from the “Record” tab it will play what was just recorded.
Hit the play button and sit back and watch your Minion Pumpkin dance to the music.
Go back and record the next Minion Pumpkin and when you to play it back both will move.
Note* Jumping in time in the music while playback is not supported. You got to watch it from the beginning

Update:
While recording Jack-O and The Lanterns we decided that we wanted to have a controllable light inside of the pumpkins. We needed a light that was bright enough to light up the pumpkins and yet simple enough to use. We settled on the GE Color effect lights. Each light bulb is controllable from a microprocessor and the RGB values can be set for a truly controllable light. I had a shorter set that I had been saving to try out with the Arduinos so I cut off a bulb for each Lantern and used the G35Arduino library to control them. See the schematic above for how to hook it up. I then modified the commands that are sent to MinionPumpkins to include light controls. 0-100 is the servo positions, 200 is a reset command to set the servo to the closed position and turns off the light.201-212 changes the colors of the light.
The C# application was also modified to let you choose the color of the light. Hitting the first button on the joystick/gamepad turns on and off the light.

Minion Software
The PC software sends 2 bytes to the Master Minion for each recorded point. It sends the MinionPumpkin number and the position to move to. The Master Minion then takes those 2 bytes and puts it into a radio packet and sends it off to all of the PumpkinMinions. Each Minion then looks at the MinionPumpkin number and if it is their number moves the servo. The position byte is just 0-100. 0 being the minimum position and 100 is the maximum position. The MinionPumpkin then looks at its minimum and maximum positions for the servo and uses the input as a scale between them. This way each MinionPumpkin is responsible for making sure it try to move its mouth too far and break it off.

Calibrating the MinionPumpkins
Most servos have between 100 and 180 degrees of motion. The ones I used had around 160. Before installing the servo into the pumpkin move the servo to find where its min and max is. You can remove the servo control arm and put it back on so that it starts at different angles. When the pumpkins mouth is closed we want the the servos control arm to be to be slightly pointing back into the mouth. This gives us room in software to to set the exact position when the mouth is closed.
Now that we have the control arm in the right position lets load up the calibration software into the minion. All this software does is let you set the position of the servo so you can see where the arm. Now you should have a rough idea of where the open and closed positions are.
Now attach the servo to the pumpkin (I used hot glue).
Once dry and before glueing the mouth on try the positions again.
Now glue the mouth on and check your positions again. Once you are happy with the open and closed positions write those numbers down. They will be used when you program add the MinionPumpkin code.

MinionPumpkin Code

This is the ID of the MinionPumpkin fromt he PC Software. It is zero based. So the first one in the list is 0, 2nd 1, 3rd 2 etc. This number needs to be changed per MinionPumpkin. If it is the same as another pumpkin they will both move together.

const byte PumpkinId=0;

These are the minimum and max positions for the mouth found while calibrating above.
int mxPos=150;
int mnPos=100;

Downloads:
MinionMaster (Arduino)

minionPumkinMaster.ino

MinionPumpkin (Arduino)

minionPumpkin.ino

MinionControl (C#)

MinionControlSoftwareSource.zip

Compiled application (You need to have SlimDX end user runtime installed from here)

MinionControlSoftwareInstaller.zip

Minion Motion Files for the recorded videos

MinionMotionFiles.zip

]]>
http://www.minioncity.com/2012/10/14/diy-animatronic-pumpkins-or-fondly-know-as-jack-o-and-the-lanterns/feed/ 6
KickStarter! http://www.minioncity.com/2012/10/07/kickstarter/ http://www.minioncity.com/2012/10/07/kickstarter/#comments Sun, 07 Oct 2012 04:58:46 +0000 Jake http://www.minioncity.com/?p=133

After months of prep work we’re finally prepared to release the MINION. There is nothing on the market that is as affordable and as functional as the Minion. With this in mind we’ve come to KickStarter to obtain the required support to get us in full production.

Some of you may ask, “What is KickStarter?” KickStart is a website that allows people with great ideas but not enough funds to bring them to reality. With this website we have prepared a campaign to obtain a following in order to fully bring the Minion into production. If you want to learn more about Kickstarter please visit: http://www.kickstarter.com/help/faq/kickstarter%20basics?ref=nav.

We’re eager to provide the Minion at  an affordable price so that more people can begin using the Arduino system and use them in more practical situations, making it more than a dev board. As we work toward our goal we ask you to visit the site and help us to make the Minion a reality.

The link to our campaign is:http://www.kickstarter.com/projects/minioncity/minion-the-wireless-enabled-dev-board?ref=home_location

]]>
http://www.minioncity.com/2012/10/07/kickstarter/feed/ 2
The Minion Car http://www.minioncity.com/2012/09/29/the-minion-car/ http://www.minioncity.com/2012/09/29/the-minion-car/#comments Sat, 29 Sep 2012 22:47:06 +0000 Nate http://www.minioncity.com/?p=105 Using 2 minions we created a computer controlled RC-Car.

One minion was loaded up with the Send/Recieve code from our previous post. It allowed us to send charactors from the serial monitor to the other minion.

The second minion was wired into the RC-Car.

We took apart the RC-Car to find out where the control points for each of the H-bridges were and wired the arduino into each of the 4 pins (plus gnd and power). This let us take over the control of the RC-Car using the existing motor control circuitry.

From there we just had to write the code that would listen to the radio until it received the steering commands.

 ”w” for forward

“s” for reverse,

“a” for left

“d” for right

” ” to turn off fwd, rvs and clear steering

 
#include

#define myNodeID 30 //node ID of Rx (range 0-30)
#define network 210 //network group (can be in the range 1-250).
#define freq RF12_915MHZ //Freq of RF12B can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. Match freq to module

typedef struct { int c1,c2 ; } Payload; // create structure - a neat way of packaging data for RF comms
Payload rxPacket;

const int Rx_NodeID=10; //emonTx node ID

const int fwd =6;
const int rvs =5;
const int lft =4;
const int rgt =7;

void setup() {
 pinMode(fwd,OUTPUT);
 pinMode(rvs,OUTPUT);
 pinMode(lft,OUTPUT);
 pinMode(rgt,OUTPUT);
 turnOff();
 rf12_initialize(myNodeID,freq,network); //Initialize RFM12 with settings defined above

}

void loop() {
 checkRadio();
}//end of void LOOP()

void turnOff()
{
 digitalWrite(fwd,LOW);
 digitalWrite(rvs,LOW);
 digitalWrite(lft,LOW);
 digitalWrite(rgt,LOW);
}

void checkRadio()
{
 if (rf12_recvDone())
 {
 if (rf12_crc == 0 && (rf12_hdr & RF12_HDR_CTL) == 0)
 {
 int node_id = (rf12_hdr & 0x1F); //extract nodeID from payload
 if (node_id == Rx_NodeID)
 { //check data is coming from node with the corrct ID
 rxPacket=*(Payload*) rf12_data; // Extract the data from the payload
 char temp1=rxPacket.c1;
 char temp2=rxPacket.c2;

if(temp1=='w' || temp2 =='w' )
 {
 turnOff();
 digitalWrite(fwd,HIGH);
 }
 if(temp1=='s' || temp2 =='s' )
 {
 turnOff();
 digitalWrite(rvs,HIGH);
 }
 if(temp1=='a' || temp2 =='a' )
 {
 digitalWrite(rgt,LOW);
 digitalWrite(lft,HIGH);
 }
 if(temp1=='d' || temp2 =='d' )
 {
 digitalWrite(lft,LOW);
 digitalWrite(rgt,HIGH);
 }
 if(temp1==' ' || temp2 ==' ' )
 {
 turnOff();
 }
 }
 }
}
}

We used the Arduino IDE Serial Monitor for original testing but the problem was you had to hit send or enter after hitting the charactor. This make it really slow to put the steering commands in. So for the drive test we switched over to Putty. Putty is a terminal emulator program that allows us to open up the serial port and send raw typed data across. As you can tell from the video below it made all the difference in the driving.

]]>
http://www.minioncity.com/2012/09/29/the-minion-car/feed/ 8
First Wireless Program http://www.minioncity.com/2012/09/21/first-wireless-program/ http://www.minioncity.com/2012/09/21/first-wireless-program/#comments Fri, 21 Sep 2012 16:07:22 +0000 Nate http://www.minioncity.com/?p=93 First things first. To use the radio we need to install the RF12 library from Jeelabs.org. I am very impressed at all the work that Jean-Claude Wippler over at jeelabs has done to put this library together. It is very well put together. You can find the latest copy at http://jeelabs.net/projects/cafe/wiki/RF12. He has even updated it to work nicely with Arduino Leonardo. We installed the library and started following Glyn Hudson's article on the RF12 library with the leonardo. Aavailable at http://openenergymonitor.blogspot.com/2012/06/arduino-leonardo-atmega32u4-and-rfm12b.html. Great writeup. We used his simple radio send test https://github.com/openenergymonitor/RFM12B_Simple to get a pair of minions up and going. The only thing that we had to change in his code to get it up and working was to add
while (!Serial);

right after the

 Serial.begin(9600);

This is needed because of the way the Leonardo is its own usb to serial convertor. The while(!Serial) says wait until something is connected to the other end of the serial port. So it wont go past that line until you open up the serial monitor.
After adding that it worked beautifully! We were way excited!
So we dug in to modify the example to a chat client.
We changed the packet format from 4 ints to 2 chars. The reason for 2 chars is if you hit enter a character then hit enter it sends the enter as well. So we send in a minimum of 2 char to get over this problem. Its not a perfect solution but it let us get a quick chat up and running.
The code is below feel free to modify and play with it.


//Modified 9/21/12 by Nate and Jake @minioncity.com
//to make a simple chat program
//Simple RFM12B wireless demo - Receiver - no ack
//Glyn Hudson openenergymonitor.org GNU GPL V3 12/4/12
//Credit to JCW from Jeelabs.org for RFM12

#include <JeeLib.h>

#define myNodeID 30 //node ID of Rx (range 0-30)
#define network 210 //network group (can be in the range 1-250).
#define freq RF12_915MHZ //Freq of RF12B can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. Match freq to module

typedef struct { int c1,c2 ; } Payload; // create structure - a neat way of packaging data for RF comms
Payload rxPacket;
Payload txPacket;

const int Rx_NodeID=10; //emonTx node ID

void setup() {

 rf12_initialize(myNodeID,freq,network); //Initialize RFM12 with settings defined above
 Serial.begin(9600);
 while (!Serial) {
 ; // wait for serial port to connect. Needed for Leonardo only
 }

Serial.println("RF12B demo Receiver - Simple demo");

 Serial.print("Node: ");
 Serial.print(myNodeID);
 Serial.print(" Freq: ");
 if (freq == RF12_433MHZ) Serial.print("433Mhz");
 if (freq == RF12_868MHZ) Serial.print("868Mhz");
 if (freq == RF12_915MHZ) Serial.print("915Mhz");
 Serial.print(" Network: ");
 Serial.println(network);
}

void loop() {

 if (rf12_recvDone())
 {
 if (rf12_crc == 0 && (rf12_hdr & RF12_HDR_CTL) == 0)
 {
 int node_id = (rf12_hdr & 0x1F); //extract nodeID from payload
 if (node_id == Rx_NodeID)
 { //check data is coming from node with the corrct ID
 rxPacket=*(Payload*) rf12_data; // Extract the data from the payload
 char temp1=rxPacket.c1;
 char temp2=rxPacket.c2;
 Serial.print(temp1);
 Serial.print(temp2);
 }
 }
 }//End of recieve code

 if(Serial.available()>0)
 {
 if(rf12_canSend())
 {
 txPacket.c1=Serial.read();
 txPacket.c2=Serial.read();
 int i=0;
 while(!rf12_canSend() && i<10)
 {
 rf12_recvDone();
 i++;
 }
 rf12_sendStart(0,&txPacket,sizeof txPacket);

char send1=txPacket.c1;
 char send2=txPacket.c2;
 Serial.print(send1);
 Serial.print(send2);
 delay(10);
 }
 }

}//end of void LOOP()
]]>
http://www.minioncity.com/2012/09/21/first-wireless-program/feed/ 0
Bootloader http://www.minioncity.com/2012/09/14/bootloader/ http://www.minioncity.com/2012/09/14/bootloader/#comments Fri, 14 Sep 2012 20:45:04 +0000 Nate http://www.minioncity.com/?p=86 After working with Jake to get the boards stuffed it was time to get down to putting the bootloader on.

I have an AVR Pocket Programmer from sparkfun a while ago for an old school project so I pulled it out and started wiring it up. Opened up the Arduino IDE (1.01) selected the USBtinyISP programmer and hit burn bootloader. Error! Ouch, time to start debugging. an hour later Jake and I discovered that the plug was loose into the programmer. It is always the simple problems that get you.

Made sure everything was tight and tried again. Wahoo, it worked! The computer recognized it as a Arduino Leonardo.

What was the first thing we put in? Blink of course :D Followed quickly by some serial tests. The Leonardo is a bit different to work with going from the UNO because of the usb that disappears and reapers as it is programmed.

]]>
http://www.minioncity.com/2012/09/14/bootloader/feed/ 0
Stuffed! http://www.minioncity.com/2012/09/12/stuffed/ http://www.minioncity.com/2012/09/12/stuffed/#comments Wed, 12 Sep 2012 04:11:00 +0000 Nate http://www.minioncity.com/?p=76

Jake is the best solder(er) that i know! He soldered these over the last few days and they look gorgeous.

Still not sure on how the final ones will look. It will come with either male or female headers. For now we are using female ones to plug things into it. But male headers soldered into a proto board would be pretty nice for a more permanent project.

Like any great prototype we found a few problems with the board. (My fault in laying out, not fusion PCB’s fault) Just a few little things. Like it has 2 GND headers next to each other (one ground is never enough when doing a circuit). One was connected and one was left unconnected. opps! Another was on the opposite header row. The +3.3v from the regulator wasn’t connected to the header. So we got one jumper down.

The problem was I had replaced the header pins in the schematic while designing and when I placed the header on i didn’t double check to make sure the lines were all connected. Looking above you would think they were all connected but the GND and the +3v3 were not. Moing the header showed which ones were connected and which weren’t.  Leason learned when ever replacing a part double check that all the lines are connected.

]]>
http://www.minioncity.com/2012/09/12/stuffed/feed/ 0
It’s ALIVE!!!! http://www.minioncity.com/2012/09/12/its-alive/ http://www.minioncity.com/2012/09/12/its-alive/#comments Wed, 12 Sep 2012 02:02:00 +0000 Jake http://www.minioncity.com/?p=64

So, the much anticipated boards have arrived (as well as the parts and the radio). They’re all here!

With these parts my fantastic soldering skills– seriously they’re impeccable– get to be put into practice.

After 30 mins of assembly and a little bit of trouble shooting (the darn LED’s were backwards) we completed the boards.

Once they were properly assembled we tested each system individually. At this point there is no information in the microprocessor so we’re just testing power lines and communication lines to make sure they’ll all working and built correctly. When we tested the lines there was a good ol’ 3.3V on the USB line and the External power!

The next step will be programming, and testing the radio!

]]>
http://www.minioncity.com/2012/09/12/its-alive/feed/ 0