<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bajdi.com</title>
	<atom:link href="http://www.bajdi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bajdi.com</link>
	<description>Breadboards Arduino Joystick DHT22 IR</description>
	<lastBuildDate>Wed, 22 Feb 2012 22:10:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Dagu Rover 5 in action</title>
		<link>http://www.bajdi.com/dagu-rover-5-in-action/</link>
		<comments>http://www.bajdi.com/dagu-rover-5-in-action/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 22:10:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rover 5]]></category>

		<guid isPermaLink="false">http://www.bajdi.com/?p=215</guid>
		<description><![CDATA[Finally I received all the parts to make a small pcb to distribute the power for my Rover 5. I soldered some terminal blocks on it so I could connect my 2 cell 7,4V Lipo battery. The Dagu red back spider robot controller and the motors get their power direct from the Lipo battery. I [...]]]></description>
			<content:encoded><![CDATA[<p>Finally I received all the parts to make a small pcb to distribute the power for my Rover 5. I soldered some terminal blocks on it so I could connect my 2 cell 7,4V Lipo battery. The Dagu red back spider robot controller and the motors get their power direct from the Lipo battery. I needed 2 voltage regulators, one LM7805 that provides 5V for the logic of the motor controller and a LM1117 that gives 3,3V to the Nrf24L01 module. I put a green led on the pcb that lights up when the power is connected. I also added a voltage divider made up of 2 10K resistors, I&#8217;ll connect it to an analog input to monitor the battery voltage.  So I can shut it down when the battery goes below a certain level. I used the code that I posted in my previous post. The Rover 5 goes very well, with the 4 motors it has lots of power <img src='http://www.bajdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  See it spinning around in the video&#8230;</p>
<p><iframe src="http://player.vimeo.com/video/37265377?title=0&amp;byline=0&amp;portrait=0" width="600" height="337" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<p><a href="http://vimeo.com/37265377">Dagu Rover 5</a> from <a href="http://vimeo.com/user10093506">Bajdi</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bajdi.com/dagu-rover-5-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote controlling the Dagu Rover 5 with a joystick</title>
		<link>http://www.bajdi.com/remote-controlling-the-dagu-rover-5-with-a-joystick/</link>
		<comments>http://www.bajdi.com/remote-controlling-the-dagu-rover-5-with-a-joystick/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 16:22:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Arduino sketches]]></category>
		<category><![CDATA[Rover 5]]></category>

		<guid isPermaLink="false">http://www.bajdi.com/?p=209</guid>
		<description><![CDATA[I&#8217;ve hooked up the 4 motors from the Rover 5 to the motor controller and connected the direction and PWM pins to the red back spider robot controller (that&#8217;s a very long name). When you connect the motors to the motor controller take a good look which motor is what number. You don&#8217;t want to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve hooked up the 4 motors from the Rover 5 to the motor controller and connected the direction and PWM pins to the red back spider robot controller (that&#8217;s a very long name). When you connect the motors to the motor controller take a good look which motor is what number. You don&#8217;t want to drive 2 motors on the same side in different directions. For this reason I left the tracks off and put a box under the chassis to easily test my little robot.<br />
I currently use a breadboard with a LM7805 and L1117D, the 7805 provides 5 Volts to the logic terminals of the motor controller and the L1117D gives 3,3V to the Nrf24L01 2,4GHz wireless module. I will make a small PCB with some terminals and the voltage regulators to connect the different voltages. I have already received a 2 cell Lipo battery, the nominal voltage of these batteries is 7,4V. But when fully charged they give 8,4V. The battery will be connected to the robot controller and the motor power terminals on the 4 channel motor controller. I haven&#8217;t been able to do this because I don&#8217;t have the right connector.<br />
To remote control the Rover 5 I connected my analog joystick and a Nrf24L01 module to my Arduino Uno. I then uploaded the same <a href="http://www.bajdi.com/wireless-control-of-2-stepper-motors/">sketch</a> that I used to remote control my 2 stepper motors. This sketch transmits the analog values from the joystick to the robot controller.<br />
In the sketch for the robot controller the values from the X and Y axis are mapped to PWM values (0-255) to set the speed and the direction is determined by setting the direction outputs high or low. The minimum pins needed to drive the 4 motors are 4 PWM pins and 4 digital output pins. For the Nrf24L01 module you need another 5 pins, 3 for the SPI bus and the CE and CSN pin. Thankfully the Dagu red back spider robot controller is based on the Arduino Mega 1280, which has 54 digital input/outputs (16 are PWM) and 16 analog inputs. So I have a lot of room for expansion <img src='http://www.bajdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Here is the sketch I&#8217;ve made to remote control the Dagu Rover 5 with an analog joystick:</p>
<pre class="brush: arduino; title: ; notranslate">
// http://www.bajdi.com
// Dagu Rover 5 chassis with 4 motors
// Remote control through Nrf24L01 2,4GHz wireless module
// µcontroller = Dagu Red back spider, Arduino Mega 1280 compatible
// Motor controller = Dagu 4 channel motor controller
// Motor 1 and 2 on the left
// Motor 3 and 4 on the right

#include &lt;SPI.h&gt;
#include &lt;Mirf.h&gt;
#include &lt;nRF24L01.h&gt;
#include &lt;MirfHardwareSpiDriver.h&gt;

/* Nrf24L01 pinout
1 GND
2 VCC (3,3V)
3 CE    pin 48 on Mega 1280
4 CSN   pin 49 on Mega 1280
5 SCK   pin 52 on Mega 1280
6 MOSI  pin 51 on Mega 1280
7 MISO  pin 50 on Mega 1280
8 IRQ (not used)
*/

int DirM1 = 30; // direction motor 1
int DirM2 = 31; // direction motor 2
int DirM3 = 32; // direction motor 3
int DirM4 = 33; // direction motor 4
int PWMM1 = 3;  // pwm motor 1
int PWMM2 = 4;  // pwm motor 2
int PWMM3 = 5;  // pwm motor 3
int PWMM4 = 6;  // pwm motor 4

int fs; // forward speed
int bs; // backward speed
int ls; // turn left speed
int rs; // turn right speed

int joystick[3];    // Array with 2 analog values (X,Y-axis) and one digital (Z-axis) from transmitter/joystick

void setup() {

  pinMode(DirM1, OUTPUT);  // direction motor 1, left front
  pinMode(DirM2, OUTPUT);  // direction motor 2, left rear
  pinMode(DirM3, OUTPUT);  // direction motor 3, right front
  pinMode(DirM4, OUTPUT);  // direction motor 4, right rear
  pinMode(PWMM1, OUTPUT);  // PWM motor 1
  pinMode(PWMM2, OUTPUT);  // PWM motor 2
  pinMode(PWMM3, OUTPUT);  // PWM motor 3
  pinMode(PWMM4, OUTPUT);  // PWM motor 4
  Mirf.cePin = 48;             //ce pin
  Mirf.csnPin = 49;            //csn pin
  Mirf.spi = &amp;MirfHardwareSpi;
  Mirf.init();
  Mirf.setRADDR((byte *)&quot;serv1&quot;);
  Mirf.payload = sizeof(joystick);
  Mirf.config();
}

void loop() { 

  int X = joystick[0];    // joystick X-axis
  int Y = joystick[1];    // joystick Y-axis 

  while(!Mirf.dataReady()){
  }
  Mirf.getData((byte *) &amp;joystick);

  if (X &gt; 500 &amp;&amp; X &lt; 540 &amp;&amp; Y &gt; 490 &amp;&amp; Y &lt; 530 )    // joystick is centered
  {
    analogWrite(PWMM1, 0);
    analogWrite(PWMM2, 0);
    analogWrite(PWMM3, 0);
    analogWrite(PWMM4, 0);
  }

  if (X &lt;= 500 &amp;&amp; Y &gt; 490 &amp;&amp; Y &lt; 530)               // joystick forward = all motors forward
  {
    fs = (map(X, 500, 0, 35, 255));
    digitalWrite(DirM1, HIGH);
    digitalWrite(DirM2, HIGH);
    digitalWrite(DirM3, HIGH);
    digitalWrite(DirM4, HIGH);
    analogWrite(PWMM1, fs);
    analogWrite(PWMM2, fs);
    analogWrite(PWMM3, fs);
    analogWrite(PWMM4, fs);
  }

  if (X &gt;= 540 &amp;&amp; Y &gt; 490 &amp;&amp; Y &lt; 530)               // joystick backward = all motors backward
  {
    bs = (map(X, 540, 1023, 35, 255));
    digitalWrite(DirM1, LOW);
    digitalWrite(DirM2, LOW);
    digitalWrite(DirM3, LOW);
    digitalWrite(DirM4, LOW);
    analogWrite(PWMM1, bs);
    analogWrite(PWMM2, bs);
    analogWrite(PWMM3, bs);
    analogWrite(PWMM4, bs);
  }

  if (Y &lt;= 490 &amp;&amp; X &gt; 500 &amp;&amp; X &lt; 540)              // joystick left = left motors backward &amp;&amp; right motors forward
  {
    ls = (map(Y, 490, 0, 35, 255));
    digitalWrite(DirM1, LOW);
    digitalWrite(DirM2, LOW);
    digitalWrite(DirM3, HIGH);
    digitalWrite(DirM4, HIGH);
    analogWrite(PWMM1, ls);
    analogWrite(PWMM2, ls);
    analogWrite(PWMM3, ls);
    analogWrite(PWMM4, ls);
  }

  if (Y &gt;= 530 &amp;&amp; X &gt; 500 &amp;&amp; X &lt; 540)              // joystick right = left motors forward &amp;&amp; right motors backward
  {
    rs = (map(Y, 530, 1023, 35, 255));
    digitalWrite(DirM1, HIGH);
    digitalWrite(DirM2, HIGH);
    digitalWrite(DirM3, LOW);
    digitalWrite(DirM4, LOW);
    analogWrite(PWMM1, rs);
    analogWrite(PWMM2, rs);
    analogWrite(PWMM3, rs);
    analogWrite(PWMM4, rs);
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bajdi.com/remote-controlling-the-dagu-rover-5-with-a-joystick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blink without delay and millis but with a DS1307.</title>
		<link>http://www.bajdi.com/blink-without-delay-and-millis-but-with-a-ds1307/</link>
		<comments>http://www.bajdi.com/blink-without-delay-and-millis-but-with-a-ds1307/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 21:54:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Arduino sketches]]></category>

		<guid isPermaLink="false">http://www.bajdi.com/?p=204</guid>
		<description><![CDATA[I&#8217;ve been breaking my head over this for the last hour. I want to use the DS1307 RTC module in a home automation project. To do certain time based things. So I thought lets try to rewrite the &#8220;blink without delay&#8221; example that comes with the Arduino IDE and use the data from the DS1307 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been breaking my head over this for the last hour. I want to use the DS1307 RTC module in a home automation project. To do certain time based things. So I thought lets try to rewrite the &#8220;blink without delay&#8221; example that comes with the Arduino IDE and use the data from the DS1307 instead of the millis function. To get the data from the DS1307 I used the code that I found on <a href="http://combustory.com/wiki/index.php/RTC1307_-_Real_Time_Clock">this</a> site. But I got very lost trying to figure out how make this simple sketch. Thankfully there are a lot of friendly helpful people on the Arduino forum who showed me how to do this. It&#8217;s actually a lot simpler then I thought.<br />
So here it is, blink without delay and millis but with the DS1307 <img src='http://www.bajdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: arduino; title: ; notranslate">
/*
 Blink without delay using a DS1307
 Led blinks once every second.
 */

#include &lt;Wire.h&gt;
const int DS1307_I2C_ADDRESS = 0x68;

const int led =  13;      // the number of the light pin
int ledState = LOW;
int lastTime = -1;
byte second, minute, hour;

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

void getDateDs1307()
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0x00);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_I2C_ADDRESS, 1);

  second     = bcdToDec(Wire.receive() &amp; 0x7f);
}

void setup() {
  Wire.begin();
  pinMode(led, OUTPUT);
}

void loop(){

  getDateDs1307();
  int time1 = second;
  if (abs(time1 - lastTime) &gt; 1)
  {
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(led, ledState);
    lastTime = time1;
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bajdi.com/blink-without-delay-and-millis-but-with-a-ds1307/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagu Rover 5</title>
		<link>http://www.bajdi.com/dagu-rover-5/</link>
		<comments>http://www.bajdi.com/dagu-rover-5/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 19:29:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rover 5]]></category>

		<guid isPermaLink="false">http://www.bajdi.com/?p=192</guid>
		<description><![CDATA[On friday DHL delivered my new toys Arduino-direct have expanded their shop with robotics, and is now offering the Rover 5 and the Dagu controller boards. I had tried to order the Rover 5 at several European shops but none could deliver one, they were all out of stock. So I ordered it from Arduino-direct [...]]]></description>
			<content:encoded><![CDATA[<p>On friday DHL delivered my new toys <img src='http://www.bajdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <a href="http://http://arduino-direct.com/sunshop/">Arduino-direct</a> have expanded their shop with robotics, and is now offering the Rover 5 and the Dagu controller boards. I had tried to order the Rover 5 at several European shops but none could deliver one, they were all out of stock. So I ordered it from Arduino-direct in China, and DHL flew it to Belgium. Took less then a week to get here. The Rover 5 is a nice platform to make a tracked or wheeled robot. I bought the version with 4 motors and encoders. With the 4 motor version you can replace the tracks with normal wheels, I&#8217;ve seen a couple of videos of Rover 5&#8242;s with wheels from the Dagu Thumper fitted. The Rover 5 comes without any electronics fitted so you can choose how to control the motors. I went for the easy solution and bought the Dagu red back spider board and the 4 channel motor controller board. The red back spider is based on the Atmel ATMega 1280 and comes with the Arduino bootloader installed. The 4 channel motor controller has support for the 4 encoders. The Rover 5 comes with a battery case for 6 AA batteries. But I&#8217;m thinking of replacing it with a Lipo battery. Easier to recharge then 6 AA&#8217;s. I will fit the Rover 5 with a nRF24L01 module so I can remote control it and 2 SRF06 ultrasonic sensors for collision detection. I&#8217;ll have to make some things myself, first thing will be a small print to supply the correct voltages to the different boards. I&#8217;ll need 3,3V for the nRF24L01 module and the accelerometer (if I decide to fit it) and 5V for the motor controller logic, but I could take that from the red back spider. Which has a powerful LM2676 5V 3A voltage regulator. The reb back spider and motor controller board came with some stand-offs, but the Rover only has 4 holes to screw them in and they are to spaced to far from each other <img src='http://www.bajdi.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  So I&#8217;ve ordered some plexiglass and will use that to mount everything on. I&#8217;ve just wrote my first sketch to the red back spider to test the motors and got the motors to spin. I strongly recommend you take the tracks of when you first test it. I had to change the polarity of one connector to make all 4 of the motors spin in the same direction.</p>

<a href='http://www.bajdi.com/dagu-rover-5/dagu-rover-5-side/' title='Dagu Rover 5 sideview'><img width="150" height="150" src="http://www.bajdi.com/wp-content/uploads/2012/02/dagu-rover-5-side-150x150.jpg" class="attachment-thumbnail" alt="Dagu Rover 5 sideview" title="Dagu Rover 5 sideview" /></a>
<a href='http://www.bajdi.com/dagu-rover-5/dagu-rover5-front/' title='Dagu Rover 5 front view'><img width="150" height="150" src="http://www.bajdi.com/wp-content/uploads/2012/02/dagu-rover5-front-150x150.jpg" class="attachment-thumbnail" alt="Dagu Rover 5 front view" title="Dagu Rover 5 front view" /></a>
<a href='http://www.bajdi.com/dagu-rover-5/dagu-rover5-top/' title='Dagu Rover 5 top view'><img width="150" height="150" src="http://www.bajdi.com/wp-content/uploads/2012/02/dagu-rover5-top-150x150.jpg" class="attachment-thumbnail" alt="Dagu Rover 5 top view" title="Dagu Rover 5 top view" /></a>
<a href='http://www.bajdi.com/dagu-rover-5/dagu-rover5-underside/' title='Dagu Rover 5 bottom'><img width="150" height="150" src="http://www.bajdi.com/wp-content/uploads/2012/02/dagu-rover5-underside-150x150.jpg" class="attachment-thumbnail" alt="Dagu Rover 5 bottom" title="Dagu Rover 5 bottom" /></a>
<a href='http://www.bajdi.com/dagu-rover-5/dagu-red-back-spider-motor-controller/' title='Dagu red back spider and 4 channel motor controller'><img width="150" height="150" src="http://www.bajdi.com/wp-content/uploads/2012/02/dagu-red-back-spider-motor-controller-150x150.jpg" class="attachment-thumbnail" alt="Dagu red back spider and 4 channel motor controller" title="Dagu red back spider and 4 channel motor controller" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.bajdi.com/dagu-rover-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino on a breadboard</title>
		<link>http://www.bajdi.com/arduino-on-a-breadboard/</link>
		<comments>http://www.bajdi.com/arduino-on-a-breadboard/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 21:07:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://www.bajdi.com/?p=186</guid>
		<description><![CDATA[The Arduino Uno together with the Arduino IDE is an easy way to program the Atmel ATmega 328P micro controller. You don&#8217;t really need to buy an Arduino board if you want to play with the Arduino IDE. You can just buy an Atmel ATmega 328P, 2 capacitors, a crystal and a 10K resistor. Plug [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_187" class="wp-caption alignnone" style="width: 630px"><a href="http://www.bajdi.com/wp-content/uploads/2012/02/arduino-uno-breadboard.jpg"><img src="http://www.bajdi.com/wp-content/uploads/2012/02/arduino-uno-breadboard-1024x682.jpg" alt="Arduino Uno on a breadboard" title="Arduino Uno on a breadboard" width="620" height="412" class="size-large wp-image-187" /></a><p class="wp-caption-text">Arduino Uno on a breadboard</p></div>
<p>The Arduino Uno together with the Arduino IDE is an easy way to program the Atmel ATmega 328P micro controller. You don&#8217;t really need to buy an Arduino board if you want to play with the Arduino IDE. You can just buy an Atmel ATmega 328P, 2 capacitors, a crystal and a 10K resistor. Plug it on a breadboard and start playing. There is one issue though you need a way to put the sketch on the micro controller. The easiest method is to use an Arduino board if you already have one. Else you can buy an ISP programmer. The official Arduino website has instructions on how to accomplish this. I bought an Atmel ATmega 328P from the official Arduino store, it already had the Arduino Uno boot loader preprogrammed. Making it all a lot easier. I used <a href="http://arduino.cc/en/Tutorial/ArduinoToBreadboard">these</a> instructions to connect the 328P to my Uno. It did need to search for some things before I could connect it all. The website doesn&#8217;t have the pinout of the ATmega 328P, you can download the data-sheet from the <a href="http://www.atmel.com/devices/ATMEGA328P.aspx?tab=documents">Atmel</a> website. The Arduino pin numbers are not the same as the ones Atmel uses in their data-sheet but I found that information <a href="http://www.hobbytronics.co.uk/arduino-atmega328-pinout">here</a>. To connect it all you only need 2 ceramic capacitors, a crystal and a 10K resistor. I had bought a set of ceramic capacitors from Arduino-direct some time ago. I didn&#8217;t know that the little numbers on them were not the value but capacitors codes. I found the information on how these translate to the value of the capacitor on <a href="http://www.csgnetwork.com/capcodeinfo.html">this</a> website.<br />
After uploading the sketch I powered the ATmega 328P on the breadboard from my lab power supply through a L7805CV voltage regulator and it worked <img src='http://www.bajdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217;s all pretty straightforward, no special tricks are involved. So now I know it&#8217;s not that difficult to make my own Arduino board <img src='http://www.bajdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bajdi.com/arduino-on-a-breadboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

