tag:blogger.com,1999:blog-9175429058899281992024-03-05T05:24:48.351+01:00Home of the generic nerdNotes, theories and random geekery.Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.comBlogger44125tag:blogger.com,1999:blog-917542905889928199.post-78834997964420290032015-01-13T19:03:00.001+01:002015-01-13T19:03:05.621+01:00Getting your local IP address in the GNU Screen status lineSo I have this <a href="http://genericnerd.blogspot.se/2009/05/converting-toshiba-320cds-to-digital.html" target="_blank">Digital Picture Frame made from an old laptop</a> at work. It doesn't have that many uses other than to amuse myself and others in the form of a music player and an overpowered clock.<br />
<br />
When I use it as a music player I use <a href="http://www.gnu.org/software/screen/" target="_blank">GNU Screen</a> and <a href="http://genericnerd.blogspot.se/2013/02/camp-console-ansi-mpeg3-player.html" target="_blank">Camp</a>, the latter in combination with <a href="http://genericnerd.blogspot.se/2014/12/cp437-bringing-high-ascii-order-to.html" target="_blank">cp437</a> of course. This gives me the ability to log in remotely from my work computer to change track, volume and whatnot. The problem is having the correct local IP address of the machine since it gets updated every 8 hours. First I wrote a script that will check the local IP and send me an e-mail with the new one if there has been any changes. I run this script via cron once an hour.<br />
<br />
But what I really wanted was to have it display in the status line of GNU Screen. It took some digging but I found <a href="http://www.linuxjournal.com/article/10950?page=0,0" target="_blank">this article</a> which mentions an option called "<a href="https://www.gnu.org/software/screen/manual/html_node/Backtick.html" target="_blank">backtick</a>" in GNU Screen. In short backtick allows you to run a command from .screenrc and have it's output displayed in the status line.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN9_h5nzwIZYHR45GgfP-esAEsSOoiS0bW3jC4XniRdbcbK87uZRY3BmBHidmRD6LxcPQQGsiotk8f-GLa6Ha4gwJCqQ5xMMxv3VASQShIdgKEG_khnq_ll9UT-NZPCr1D5gZQ9xuNf5MX/s1600/Sk%C3%A4rmklipp.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN9_h5nzwIZYHR45GgfP-esAEsSOoiS0bW3jC4XniRdbcbK87uZRY3BmBHidmRD6LxcPQQGsiotk8f-GLa6Ha4gwJCqQ5xMMxv3VASQShIdgKEG_khnq_ll9UT-NZPCr1D5gZQ9xuNf5MX/s1600/Sk%C3%A4rmklipp.jpg" height="240" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">An almost 20 year old laptop chugging along on Debian Wheezy playing <br />
music and pulling of a look that might induce wet dreams to retro nerds. </td></tr>
</tbody></table>
<h3>
How to do it</h3>
I've added the following to my .screenrc<br />
<span style="font-family: Courier New, Courier, monospace;">backtick 101 600 600 hostname -I</span><br />
<br />
<b>101 </b>is the identifier of this particular backtick that will be used in the status line string, it could just as well be 1 or whatever number I choose.<br />
<b>600 </b>and <b>600 </b>determines how often to run the program and how often to refresh the line. I use the same number on both mainly because that's what the author of the article did and I don't see any reason to go beyond that. If you're curious read more about it <a href="https://www.gnu.org/software/screen/manual/html_node/Backtick.html" target="_blank">here</a>.<br />
<b>hostname -I </b>this is the command I run to get my local IP address.<br />
<br />
That's it for the command but you need to add want to display the output in the statusline:<br />
<span style="font-family: Courier New, Courier, monospace;">hardstatus alwayslastline "%{= g} %{= w}%-Lw%{=r}%n%f* %t %{-}%+LW %-=%| %101` | %D %M %d %Y %c:%s"</span><br />
<div>
<div>
<br /></div>
<div>
So really I just added <b>%101` </b>(yes the ` is required) to the string in order to display the output. That and two | and a couple of spaces to act as dividers. </div>
<div>
<br /></div>
<div>
Now don't come around asking me questions on GNU Screen's status line because that is a whole other story. I barley know what mine does. </div>
</div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-16523475175133984002014-12-16T20:15:00.001+01:002014-12-16T20:15:13.038+01:00cp437 - bringing high ASCII order to the fucked up world of UTF8Let's get one thing straight, I absolutely love ANSI graphics. But lately, and by lately I mean since 200X, getting my daily fix of this Graffitti-esque artstyle that had it's glory days in the early 90's has become a bit of a hassle. Sure you can mess around with your charset settings and fonts <a href="http://genericnerd.blogspot.se/2013/02/camp-console-ansi-mpeg3-player.html" target="_blank">like I've done</a>, but that will probably affect the usability of the rest of your system... in a negative way.<br />
<br />
So when I, as a newcomer to reddit, <a href="http://www.reddit.com/r/commandline/comments/2ovwll/how_do_you_get_ancient_ansi_beauty_like_this_to/" target="_blank">asked for help in the /r/commandline subreddit</a> I got the answer: <a href="https://github.com/keaston/cp437" target="_blank">cp437</a> an app so easy to use it's almost painful to think of all the headaches I've had trying to get ANSI to display properly in Linux virtual console and assorted terminal emulators.<br />
<br />
After installation it's merely a matter of typing "cp437" followed by the app of your choice for instance:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ cp437 camp</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ cp437 duhdraw</span><br />
<br />
It even works under GNU screen, to some extent. To be honest I had trouble with getting <a href="http://www.wwco.com/~wls/opensource/duhdraw.php" target="_blank">DuhDraw</a> to paint properly under GNU screen the first time I tried it.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXnEUucCCTpA72OEmVzjqT1abxOW_2IIwN0xn_16gWIDmqkQoL7G0EMMR8dVteXg7hsZRmisHPx5lzD3DRmvBNaZbM4v6WK1GQDxpwO468Ua5p4TWw0WoBsQkH_C4t9mS-MGtUSFIvnAh4/s1600/camp1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXnEUucCCTpA72OEmVzjqT1abxOW_2IIwN0xn_16gWIDmqkQoL7G0EMMR8dVteXg7hsZRmisHPx5lzD3DRmvBNaZbM4v6WK1GQDxpwO468Ua5p4TWw0WoBsQkH_C4t9mS-MGtUSFIvnAh4/s1600/camp1.png" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Camp, in all it's properly rendered ANSI glory. <br />
The image is a bit offset because my virtual console is <br />
larger than 80 columns and 25 lines. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNrLyO01-mOLL7-E5E4nxeyzCjZU9AzvsIqaRx3nGDSZmwSjdPM34nwvNAKou9BbmArxuSBOybFjIEPlQgXV2tT0Gju31Htgia6v-EmVNwKBPYvbtz3gepM7ukdUMV8NKhB_WMFVGg2Abt/s1600/camp2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNrLyO01-mOLL7-E5E4nxeyzCjZU9AzvsIqaRx3nGDSZmwSjdPM34nwvNAKou9BbmArxuSBOybFjIEPlQgXV2tT0Gju31Htgia6v-EmVNwKBPYvbtz3gepM7ukdUMV8NKhB_WMFVGg2Abt/s1600/camp2.png" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP file selection menu. <br />No there's no<span style="font-size: 12.8000001907349px;"> little "screen;" thing in the corner. ;)</span></td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP3lc9oF4XhJLEPbTL0ykfHdqcJ_aAffqYi94prhrJf7YMLbYJUbfP22CHoB-X2QRTOnJemRTVqGtzgfLIvpZpQOeTkmuv2t42LIzSUdjM3HIwpqwN6rKgTx3aagGMsKup9x2tkvw7GsN-/s1600/duhdraw1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP3lc9oF4XhJLEPbTL0ykfHdqcJ_aAffqYi94prhrJf7YMLbYJUbfP22CHoB-X2QRTOnJemRTVqGtzgfLIvpZpQOeTkmuv2t42LIzSUdjM3HIwpqwN6rKgTx3aagGMsKup9x2tkvw7GsN-/s1600/duhdraw1.png" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Quick Ansi doodle in DuhDraw. </td></tr>
</tbody></table>
<br />
<br />
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-52920421609038825152014-11-24T20:13:00.001+01:002014-11-24T20:28:54.735+01:00Child proofing an electric candle and making it flickerSince my daughter comes from a long line of droppers her <a href="http://en.wikipedia.org/wiki/Saint_Lucy%27s_Day">Lucia candle</a> didn't get much mileage before she dropped it and broke the glass bulb. Glass bulb you say, yes. These hand held electric candles haven't seen much product development in the last thirty years or so.<br />
<br />
Lucia is a typical Swedish holiday that combines our favourite pastimes mys* and fika**. Usually it's celebrated by a Lucia train err... a better translation would probably be Lucia procession.<br />
<div>
<br /></div>
<i>* <span style="font-size: x-small;"><b>Mys</b>: activity that makes you feel all warm an fuzzy inside i.e. cozy </span></i><br />
<i>** <span style="font-size: x-small;"><b>Fika</b>: Eating various types of buns and cookies while consuming either coffee, tea or other seasonal beverage.</span></i><br />
<i><span style="font-size: x-small;"><br /></span></i>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw-_7JWtqaG8OMp-lG-q3Et-Gd7FSNMOyDFprFiIonIxYMyLVfNFYwrOg7mtCxuswxV-oRMrQPVgjVwS4rvjhyPbc428Qqh2oLu795bkTeKzDr3o7DuGaVSUHF3uxT91UdxGges5U5ov4t/s1600/77092F58-3FA8-49FE-956B-C9DB2906ED20.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw-_7JWtqaG8OMp-lG-q3Et-Gd7FSNMOyDFprFiIonIxYMyLVfNFYwrOg7mtCxuswxV-oRMrQPVgjVwS4rvjhyPbc428Qqh2oLu795bkTeKzDr3o7DuGaVSUHF3uxT91UdxGges5U5ov4t/s400/77092F58-3FA8-49FE-956B-C9DB2906ED20.JPG" height="400" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Typical Swedish electric Lucia Candle and bulb. </td></tr>
</tbody></table>
<span style="background-color: red;"><br /></span>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-86HsZiuJJFE/UQZ2p2CAZvI/AAAAAAAAhmY/z5e5hbzILAw/s1600/972AB932-3F7A-4E7B-BE40-8648FEFCA626.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-86HsZiuJJFE/UQZ2p2CAZvI/AAAAAAAAhmY/z5e5hbzILAw/s400/972AB932-3F7A-4E7B-BE40-8648FEFCA626.JPG" height="400" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Broken glass everywhere, <a href="http://www.youtube.com/watch?v=gYMkEMCHtJ4">people pissing on the station you know they just don't care</a> ... Err sorry got a little carried away there. </td></tr>
</tbody></table>
<span style="background-color: red;"><br /></span>
<br />
Anyway as I was picking up the shards I wondered why they didn't use LEDs for kids candles. But a manufacturers apparent failure to satisfy its customers is a perfect reason for a maker to take things into her or his own hands.<br />
<br />
But just using a LED wouldn't be very fun, no we definitely need more awesomeness!<br />
<br />
<h3>
</h3>
<h3>
Circuitry</h3>
Below is the circuit I designed for this project. It's really simple but I did run into some problems when I realized the ATtiny85 only has 2 PWM outputs. Turns out I was wrong it actually has 4 PWM outputs but two of them share the pin with analog input. Since no input is used in this project that wasn't a problem at all.<br />
<br />
<b>Please note:</b> There is one major flaw with my circuitry. I calculated the resistors using the 5V output voltage on the Arduino board. Since this is meant to be powered from standard 1.5V button cell batteries it is far from ideal preferably I should have calculated the resistors for 4.5V. However it actually does work with as low as 3V but the colors are a bit off and dim.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibDuBOx42-GvwOQol-kY5vRBkTQcLPJYwzMKl7F2-wjZuA6xiykMg9muF7bscv82P7AV8Wabe23eenxTj1Gm-JdtiYS3ufzkAONzC41emBT9gQQbEwItTfV3JdxIDuwHHuDuYeNBjRIRHn/s1600/flickeringcandleattiny85.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibDuBOx42-GvwOQol-kY5vRBkTQcLPJYwzMKl7F2-wjZuA6xiykMg9muF7bscv82P7AV8Wabe23eenxTj1Gm-JdtiYS3ufzkAONzC41emBT9gQQbEwItTfV3JdxIDuwHHuDuYeNBjRIRHn/s1600/flickeringcandleattiny85.png" height="318" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Simple circuit using the ATtiny85 microcontroller, an RGB LED and some resistors. </td></tr>
</tbody></table>
<br />
<h3>
</h3>
<h3>
Breathing life into a flame</h3>
Ok, so we have the circuit down, now we need some code to run on the microcontroller. I've written a very short code snippet which uses simple randomness to create a flickering effect. Since there are differences in LEDs you might have to fine tune it according to your hardware, however it should be a pretty simple job as the code is pretty much self explanatory and commented where needed.<br />
<br />
Download the <a href="https://www.dropbox.com/s/autiejzz83d1vbt/FlickeringCandle.ino?dl=0" target="_blank">source code here</a>.<br />
<div>
<br /></div>
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>/*
Flickering Candle
Emulates a candle flickering with a RGB LED
By Markus Ulfberg 2013-02-01
Updated: 2014-11-24
Uses ATtiny85
*/
// Depending on your board, comment out either the ATtiny85/Arduino
// pin variables below.
// LED pins Arduino Board
// int ledRed = 3;
// int ledGreen = 5;
// int ledBlue = 6;
// LED pins Attiny85
int ledRed = 0; // Chip pin 5
int ledGreen = 1; // Chip pin 6
int ledBlue = 4; // Chip pin 3
// LED Power variables
byte redPwr = 0;
byte greenPwr = 0;
byte bluePwr = 0;
void setup()
{
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledBlue, OUTPUT);
}
void loop()
{
lightMyFire();
} // END loop()
void lightMyFire() {
// Flicker will determine how often a fast flare will occur
int flicker;
// set flicker randomness
flicker = random(800);
// Set color of fire, use a short range to make emulate the
// smooth movement of a flame.
// Flicker up
// when flicker occur, the colors shine brighter
// adding blue creates a white shine
if (flicker > 750) {
redPwr = 255;
greenPwr = 55;
bluePwr = 5;
}
// Flicker down
// when flicker occur, the flame goes down in intensity
// and towards a reddish tone
if (flicker < 20) {
redPwr = random(60, 70);
greenPwr = random(5, 15);
bluePwr = 0;
// Main flame color
} else {
redPwr = random(190, 200);
greenPwr = random(40, 50);
bluePwr = 0;
}
// display Colors
colorDisplay();
// Set speed of fire
// The randomness of the delay creates a more natural erratic flame
delay(random(30, 200));
} // END lightMyFire
// Displays the colors when called from lightMyFire
void colorDisplay() {
analogWrite(ledRed, redPwr);
analogWrite(ledGreen, greenPwr);
analogWrite(ledBlue, bluePwr);
}
</code></pre>
<i><span style="font-size: x-small;">Source code formatted for blogger by: <a href="http://formatmysourcecode.blogspot.com/">formatmysourcecode.blogspot.com</a></span></i><br />
<h3>
</h3>
<h3>
</h3>
<h3>
Programming the ATtiny85 using the Arudino</h3>
So you've got your code and you want to upload it to the ATtiny85? Others have written better tutorials on this than I ever will so please check out this site instead: <a href="http://www.forkrobotics.com/2012/04/run-arduino-code-on-an-attiny/">www.forkrobotics.com/2012/04/run-arduino-code-on-an-attiny/</a><br />
<div>
<br /></div>
<div>
Here's two pretty pictures of me doing the same. </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFaO2rhzmyukYzQ4Se0rowNYYh_sJin6V3TyW4Q3UswVOnpjoncEPJ9fNtgW6wYwQNBgg1ZSpunC33dBA-FTI4dZ3l37roMzl0smCI3u2s7xq7nmKhSFnnCYxI314-xnrJniS4yjewJ61H/s1600/674736E1-B2D3-4D4A-9F89-F151F6E018CE.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFaO2rhzmyukYzQ4Se0rowNYYh_sJin6V3TyW4Q3UswVOnpjoncEPJ9fNtgW6wYwQNBgg1ZSpunC33dBA-FTI4dZ3l37roMzl0smCI3u2s7xq7nmKhSFnnCYxI314-xnrJniS4yjewJ61H/s400/674736E1-B2D3-4D4A-9F89-F151F6E018CE.JPG" height="400" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Programming the ATtiny85 using the Arduino as ISP.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-TkbhYsNguyINvVcu8gAtIsOA-4NMnZkzepXcOuL8CJas-6T1uMUMeamNAl6B-qcndXlsKIoHA5vbSxjqx_vj5C7u5sQUHYSTTeNuFwoi5h-0q7AeaBEkNUfUHEV_MwPwLLVSTv8Rxgx4/s1600/150F4135-1F9C-46A0-8CE4-E2BF802C21AB.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-TkbhYsNguyINvVcu8gAtIsOA-4NMnZkzepXcOuL8CJas-6T1uMUMeamNAl6B-qcndXlsKIoHA5vbSxjqx_vj5C7u5sQUHYSTTeNuFwoi5h-0q7AeaBEkNUfUHEV_MwPwLLVSTv8Rxgx4/s400/150F4135-1F9C-46A0-8CE4-E2BF802C21AB.JPG" height="400" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Running the sketch on the ATtiny85, drawing only power from the Arduino. </td></tr>
</tbody></table>
<br />
<h3>
Building a better candle </h3>
<div>
I've spent two years trying to make the circuit fit inside the original candle. It's not really that hard but I've restarted this project just in time to realize I won't make the deadline of Lucia and then my interest faded and I shelved the project until next year. </div>
<div>
<br /></div>
<div>
Last year I made this little circuit by cutting a small strip of perfboard that will fit inside the candle body. </div>
<div>
<br /></div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-wM1WMv2xhY4/UkpUwZbW6ZI/AAAAAAAAnMk/qTZMm-a_etI/s1600/IMG_0232.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-wM1WMv2xhY4/UkpUwZbW6ZI/AAAAAAAAnMk/qTZMm-a_etI/s1600/IMG_0232.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Almost done, just need to add power. </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-NyH6NEieOGc/UkpUwX-NmAI/AAAAAAAAnMY/8x4iF5bpSnU/s1600/IMG_0234.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-NyH6NEieOGc/UkpUwX-NmAI/AAAAAAAAnMY/8x4iF5bpSnU/s1600/IMG_0234.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Bottom of unfinished circuit on perfboard.</td></tr>
</tbody></table>
<br />
<h4>
Moving on ...</h4>
Some of the main problems that I didn't solve last year was finding a good ON/OFF switch, making a suitable power pack and some sort of diffuser for the LED.<br />
<br />
For the ON/OFF switch I decided to take easy way out and just skip it. I could always add it later if I come across a small enough SPST switch. As for power I soldered on the existing power cables from the candle to the perfboard.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0v6ozsInm0fCLcjhXVDDr9lxLmcr79Hbi8XIFjvPbsY6qtIOtjtgDaChsJVUWrxuiOUqYzyimplnzIQaYG8fCtMPDKAInLOwPyofhPPIx0tOd2WcuJSZdmFPry6JefN134hXz2PCvA30H/s1600/IMG_2628.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0v6ozsInm0fCLcjhXVDDr9lxLmcr79Hbi8XIFjvPbsY6qtIOtjtgDaChsJVUWrxuiOUqYzyimplnzIQaYG8fCtMPDKAInLOwPyofhPPIx0tOd2WcuJSZdmFPry6JefN134hXz2PCvA30H/s1600/IMG_2628.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Adding power connectors, using the existing ones in the candle.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ9wmX_3RGS1ie_nYo2H595boIssuBLTYwqSyo5poPudlt1LJCgVzbfg84P5UFf2dzQRHApo5Zw5cfGWd8bPHii7sjy62VDMWkot-gEko7SUhdTTZG6s5V4tkkoUgLrHrVTAIho9Xep9sN/s1600/IMG_2627.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ9wmX_3RGS1ie_nYo2H595boIssuBLTYwqSyo5poPudlt1LJCgVzbfg84P5UFf2dzQRHApo5Zw5cfGWd8bPHii7sjy62VDMWkot-gEko7SUhdTTZG6s5V4tkkoUgLrHrVTAIho9Xep9sN/s1600/IMG_2627.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Just another shot of the back of the circuit. </td></tr>
</tbody></table>
<br />
My power pack consists of three 1.5V LR44 button cell batteries. In order to get them to fit the cradle I just moved the spring closer to the bottom. Et voila, we have a very flimsy battery cradle. I'll probably add some plastic or something to make sure they don't rattle around when we actually use the candle.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuymNPwV08vB5s31OYBUMshu35BRGvC4rtzrKtHoftd02QaYtWHPI7RvrYHWR9BT7rvaV9OaTDxj0twB7RNFo12EkSZ8_gATNkMSueXzF1Z5lp56-0r8ot7U3JxCDvLNIsssHkw0FIfxvV/s1600/IMG_2630.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuymNPwV08vB5s31OYBUMshu35BRGvC4rtzrKtHoftd02QaYtWHPI7RvrYHWR9BT7rvaV9OaTDxj0twB7RNFo12EkSZ8_gATNkMSueXzF1Z5lp56-0r8ot7U3JxCDvLNIsssHkw0FIfxvV/s1600/IMG_2630.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The three batteries and the spring prior to hot glueing it into place. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXMt1HZAvoq5BinESm5gDMr8d7su0gFmLCIXOMhjqcV3d3uzOfT0XlTFFfIFXPx3PldR-_Vt0syMv5fjjmaJzd4GSEud33aIPmQ5xED7asn7xYENOMwH_7e15LtpW2f9tyETIr7OvgGDTk/s1600/IMG_2635.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXMt1HZAvoq5BinESm5gDMr8d7su0gFmLCIXOMhjqcV3d3uzOfT0XlTFFfIFXPx3PldR-_Vt0syMv5fjjmaJzd4GSEud33aIPmQ5xED7asn7xYENOMwH_7e15LtpW2f9tyETIr7OvgGDTk/s1600/IMG_2635.JPG" height="320" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Finished cradle, not pretty but it works. </td></tr>
</tbody></table>
<br />
<h4>
Nasal spray to the rescue </h4>
Around October, I got one of the ten mandatory colds that you get during the season. I also decided to try out a new nasal spray that uses only saline. This means you can spray away as much as you like without the drawbacks of normal nasal spray abuse. It also meant that I finally found a good diffuser for the LED. The cap to the nasal spray had a nice shape of semi transparent plastic, just what I needed for my project.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkP9rkNENrP7TyMRPva32QpIyJzzSgs8zz0R9YkQqaMWLg2-j-M_XDPCXk62G0Days1Zada0zu66_BDDlfoRl1APMMhwOIW3KYWOQo73p4jfztC7IVdDJVJM0ERBMl0g02aVa0EAX2dh3o/s1600/IMG_2631.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkP9rkNENrP7TyMRPva32QpIyJzzSgs8zz0R9YkQqaMWLg2-j-M_XDPCXk62G0Days1Zada0zu66_BDDlfoRl1APMMhwOIW3KYWOQo73p4jfztC7IVdDJVJM0ERBMl0g02aVa0EAX2dh3o/s1600/IMG_2631.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Nasal spray cap used as a diffuser for the RGB LED.</td></tr>
</tbody></table>
<br />
<br />
<h3>
This is the end ... result. </h3>
<br />
Ok, so up close the color mixing isn't really perfect. I guess we can blame either the diffuser, my code or my inability to use the correct voltage when calculating what resistor to use. But it works and hey, that's the fun part isn't it?<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/NkKKjlWcGPE?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP0e7uV6uqvx4WPpaY_qcJBQQR1_1nAWycPLYnc7mw1QlBkqVpkKQeojSHFO661U65GN0j57byqATt6dy_itinjhuCnl1D84LgL_egPwFIDHjJzBEuDMTBplZpHJB9Sjf5_ngH4wiHfX3R/s1600/IMG_2636.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP0e7uV6uqvx4WPpaY_qcJBQQR1_1nAWycPLYnc7mw1QlBkqVpkKQeojSHFO661U65GN0j57byqATt6dy_itinjhuCnl1D84LgL_egPwFIDHjJzBEuDMTBplZpHJB9Sjf5_ngH4wiHfX3R/s1600/IMG_2636.JPG" height="320" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The result in all it's saintly glory. </td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
</div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-54109880946780450082013-10-15T19:57:00.001+02:002013-10-15T19:57:53.163+02:00Apparently I write game reviews now<h4>
Today I posted my first game review ever. It's a review of C64anabalt, a Commodore 64 port of the 2009 indie platform game. </h4>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-b7o-AZMMenk/UlRRmcpgFxI/AAAAAAAAnZ8/jFQPlTFiIzw/s1600/IMG_0284.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="http://3.bp.blogspot.com/-b7o-AZMMenk/UlRRmcpgFxI/AAAAAAAAnZ8/jFQPlTFiIzw/s400/IMG_0284.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Could very well be the first C64 game I've bought with my own hard earned cash.</td></tr>
</tbody></table>
After flaunting my purchase of <a href="http://www.rgcd.co.uk/2011/12/c64anabalt-c64-2011.html">C64anabalt</a> on <a href="https://plus.google.com/101720902084288838382/posts/WfbNcgbeDV2">Google+</a> I was approached by the owner of the blog <a href="http://www.mycommodore64.com/">My Commmodore 64</a> and asked to write a review. So I did.<br />
<br />
So what are you waiting for, off to <a href="http://www.mycommodore64.com/2013/10/15/c64anabalt-endless-fun/">My Commodore 64</a> you go!Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-60193317116686932052013-09-16T21:56:00.000+02:002013-09-16T21:56:38.823+02:00Unsuccessful: Wireless Arduino Mood Light Controller v4<span style="font-size: x-small;"><b>Prologue: </b></span><br />
<span style="font-size: x-small;">I started writing the below post about a year ago but in the end I never really found a solution to the problem and consequently I never finished the post. </span><span style="font-size: x-small;">Sometime it's best to know when to quit, b</span><span style="font-size: x-small;">ut maybe this project can be of use to you anyway. Or maybe you'll find the solution that I didn't... well if you do please let me know. </span><br />
<br />
<h2>
Look Ma no wires!</h2>
Ok, so I've built an Arduino based Mood Light Controller and I've managed to get my Arduino to send integers over RF with VirtualWire. Finally I've also built my first Arduino Standalone ATmega / Arduino Bare.<br />
<br />
Now I've combined the three into one Wireless Arduino Mood Light Controller. To be honest I had two very different projects planned for my Standalone ATmega and the RF part but those sort of became obsolete in my current living situation.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBkLhtfaWcDblzL502SjO4IMLu56qXTdMfWzu29cvIYB8R7cqUOAXwUzr0AaZWg0C6SemZUU3iKWobgzghDqwXDR0WSDdDwCDfWWqPvJGFLkzYX2xEV0w0GwsOxogoSCxN0JzQzZKwNmbS/s1600/Arduino_RGB-LED_Controller_RF-Receiver_circuit.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="269" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBkLhtfaWcDblzL502SjO4IMLu56qXTdMfWzu29cvIYB8R7cqUOAXwUzr0AaZWg0C6SemZUU3iKWobgzghDqwXDR0WSDdDwCDfWWqPvJGFLkzYX2xEV0w0GwsOxogoSCxN0JzQzZKwNmbS/s320/Arduino_RGB-LED_Controller_RF-Receiver_circuit.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Original circuit drawn with <a href="http://www.circuitlab.com/">www.circuitlab.com</a></td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR-ZW1CZ4dJEpKtoRjR3ZwOJG0rNoSRWTg68Nbx9QYXZVoBJUgBPatNuhsokHHcIW-w6qO7RCEHOPlUaZZIEQTEzc0Yx-8s4vUr_jPl6D2GPY8xCCAYfpPqIhTwaV1DVBjnXERj5UWxRQL/s1600/RF-Receiver_RGB-Controller_1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR-ZW1CZ4dJEpKtoRjR3ZwOJG0rNoSRWTg68Nbx9QYXZVoBJUgBPatNuhsokHHcIW-w6qO7RCEHOPlUaZZIEQTEzc0Yx-8s4vUr_jPl6D2GPY8xCCAYfpPqIhTwaV1DVBjnXERj5UWxRQL/s320/RF-Receiver_RGB-Controller_1.jpg" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Above circuit breadboarded on a protoshield.</td></tr>
</tbody></table>
<br />
<h3>
A bug in the code? </h3>
When I first merged the RGB Mood Light code with the RF Receiver code my Arduino kept hanging. Confident in my own coding skills I quickly aimed my blame towards those who write librarys for the Arduino IDE. The good folks in the Arduino forum managed to deflate my swelling ego and pointed out a few flaws in my code before coming to the conclusion that it might be a hardware problem.<br />
<br />
"The rise and fall of a ego" is available as a thread in the <a href="http://arduino.cc/forum/index.php/topic,136924.0.html">Arduino forum</a>.<br />
<br />
Meanwhile back on earth ...<br />
I <a href="http://arduino.cc/forum/index.php/topic,137605.0.html">moved my question to the General Electronics</a> part of the Arduino forum, this time with a little more humble attitude. After following the instructions of Grumpy_Mike I quickly learned that my problems came from interference caused by using PWM to control the RGB LED. The trick was to swap out the resistors to 1K Ohm resistors in order to minimize the current and the interference it caused. With 1K Ohm resistors everything worked flawless, well except for the LED that got quite dim.<br />
<br />
To minimize the interference Grumpy_Mike suggested the use of capacitors and/or ferrite beads. This actually helped a bit but still not good enough.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZNBmHJBQCCtATyu4LqAAbmo2n7dA4FjDchA5EGa3sLZVFL2Lht5kF6_4wJqACy1YaKZcjHlTuz5lyEbqgfWQCFpQDGjuIYueKZee7SnlwSCG9aq63Mr04Wdx-2fOnyTxwQVuW_I2us8Ux/s1600/Arduino_RGB-LED_Controller_RF-Receiver_circuit_wCaps.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="298" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZNBmHJBQCCtATyu4LqAAbmo2n7dA4FjDchA5EGa3sLZVFL2Lht5kF6_4wJqACy1YaKZcjHlTuz5lyEbqgfWQCFpQDGjuIYueKZee7SnlwSCG9aq63Mr04Wdx-2fOnyTxwQVuW_I2us8Ux/s320/Arduino_RGB-LED_Controller_RF-Receiver_circuit_wCaps.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Improved circuit with capacitors to stop interference caused by PWM.</td></tr>
</tbody></table>
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFr3B5jCZVOAtdcb0Ra_NaAUXYXhCXK1P74sVnYYLWrvRzrTqvNZDKJb7PaZcb3sxdW3rssk43oYamD7BpPBuO0n1_b0GpxlwNqb5K3FePY0tDTUGp3zFVBRs-twt-j2byiSt2Gk31ogLB/s1600/2012-12-20+17.01.57.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFr3B5jCZVOAtdcb0Ra_NaAUXYXhCXK1P74sVnYYLWrvRzrTqvNZDKJb7PaZcb3sxdW3rssk43oYamD7BpPBuO0n1_b0GpxlwNqb5K3FePY0tDTUGp3zFVBRs-twt-j2byiSt2Gk31ogLB/s320/2012-12-20+17.01.57.jpg" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Above circuit breadboarded on a protoshield.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1W-Cz0uy_F-bH6mfuOGm-OSjjKtM0R358ciDPux0rtRah64gDu9sMttz3OPXBO632VIbO3sqMfn2K1WECFFSYZ3Iis8JqokQI940UhrnUb7U9O6eWme9ygsi9ANP1KsT-2ejAkawBOzP1/s1600/2012-12-20+17.01.29.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1W-Cz0uy_F-bH6mfuOGm-OSjjKtM0R358ciDPux0rtRah64gDu9sMttz3OPXBO632VIbO3sqMfn2K1WECFFSYZ3Iis8JqokQI940UhrnUb7U9O6eWme9ygsi9ANP1KsT-2ejAkawBOzP1/s320/2012-12-20+17.01.29.jpg" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Kind of messy and lot's of wires that can cause interference. </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Apparently the problem with a circuit like this is that every lead and wire is a source of interference.So I was advised to try to make the circuit tidier, shorten leads and hope for the best.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-5Ku-45A0YDc/UOqMnOyEY-I/AAAAAAAAhRs/ngqNTh3IvN8/s1600/B980E355-7A06-40C5-9AA2-85F33E05E09C.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://2.bp.blogspot.com/-5Ku-45A0YDc/UOqMnOyEY-I/AAAAAAAAhRs/ngqNTh3IvN8/s320/B980E355-7A06-40C5-9AA2-85F33E05E09C.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Leads of the LED and resistors trimmed down ... </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-pcL-KCyB3z4/UOqMnEoZlGI/AAAAAAAAhRs/kNjGiFzeHnI/s1600/1735F4B1-EAC7-40F9-BBCC-2B62A7949A83.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://2.bp.blogspot.com/-pcL-KCyB3z4/UOqMnEoZlGI/AAAAAAAAhRs/kNjGiFzeHnI/s320/1735F4B1-EAC7-40F9-BBCC-2B62A7949A83.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">... and the RF receiver connected via a ferrite bead as well as an added physically distance. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-tKMOgj6e69Y/UOqMnFAQfqI/AAAAAAAAhRs/z2enhUzMvMA/s1600/0DD7C846-03F2-411F-A0EF-AF703EA0CEEE.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://4.bp.blogspot.com/-tKMOgj6e69Y/UOqMnFAQfqI/AAAAAAAAhRs/z2enhUzMvMA/s320/0DD7C846-03F2-411F-A0EF-AF703EA0CEEE.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Also the power supplied to the RF receiver is decoupled with a capacitor. </td></tr>
</tbody></table>
<br />
<h3>
Dead end? </h3>
Unfortunately all this helped very little... and I'm sort of stuck. If you do find a solution to this please let me know as I would love to finish this project.<br />
<br />
<h3>
Source code</h3>
<a href="https://www.dropbox.com/s/05yovgc5dhbsunj/VirtualWire_Integer_TX.ino">Transmitter code</a><br />
<a href="https://www.dropbox.com/s/mgd9vr31378fu58/rgb_mixer_RF_controlled_pulse_makkan_v4_ino.ino">Receiver code</a><br />
<br />
<b>Please note:</b> The above code is a work in progress and could change, stop working (worse than it already does) with out notice.<br />
<div>
<br /></div>
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-51655273272674912812013-09-04T17:16:00.004+02:002013-09-04T17:16:42.813+02:00Upgrading from Squeeze to Wheezy using Cupt<a href="http://inconsolation.wordpress.com/2013/08/27/aptitude-one-just-for-the-swirlies/#comments">I recently read about Cupt</a> a rewritten apt-get replacement that apparently would be more suitable for low end machines. Well it's not specifically written for low end machines, I guess it's just less resource demanding.<br />
<br />
Anyway I decided to try upgrading my old Toshiba 320CDS from Debian Squeeze to Wheezy using cupt. Upgrading in <a href="https://wiki.debian.org/Cupt">Cupt </a>comes in a couple of different flavors. I decided to go with the one I know best:<br />
<span style="background-color: #eeeeee; font-family: 'Courier New', Courier, monospace;">sudo cupt update </span><br />
<span style="background-color: #eeeeee; font-family: 'Courier New', Courier, monospace;">sudo cupt dist-upgrade </span><br />
<div>
<span style="background-color: #eeeeee; font-family: 'Courier New', Courier, monospace;"><br /></span></div>
Actually all things went fairly smooth apart from conky breaking the upgrade halfway through. I resolved this minor issue by just removing conky (<span style="background-color: #eeeeee; font-family: Courier New, Courier, monospace;">sudo cupt remove conky</span>) when the upgrade broke and then just start the upgrade from scratch (or whatever state my system was left in).<br />
<br />
When the upgrade was done, everything seemed to be ok, but at reboot I was dropped to busybox...(sigh) as usual. This happens because I have to used the <span style="font-family: Courier New, Courier, monospace;">ide-generic</span> kernel module to boot from my ide disks.<br />
I typed in:<br />
<span style="background-color: #eeeeee; font-family: Courier New, Courier, monospace;">modprobe ide-generic </span><br />
<br />
But my system said that no module with that name was available... (this is where I panicked and retyped that about twenty times trying different combinations of ide, -,_ and generic). Naturally that didn't accomplish anything so I googled a bit and found that <span style="font-family: Courier New, Courier, monospace;">ide-generic</span> had been removed from the kernel packages and been replaced by<span style="font-family: Courier New, Courier, monospace;"> pata_legacy.ko</span><br />
So instead I tried:<br />
<span style="background-color: #eeeeee; font-family: Courier New, Courier, monospace;">modprobe pata-legacy </span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
The module loaded and my drives were recognized. I hit CTRL-D and the boot resumed.<br />
<br />
As soon as my system was up and running I replaced <span style="font-family: Courier New, Courier, monospace;">ide-generic</span> with <span style="font-family: Courier New, Courier, monospace;">pata-legacy</span> in <span style="font-family: Courier New, Courier, monospace;">/etc/initramfs-tools/modules</span><br />
and issued:<br />
<span style="background-color: #eeeeee; font-family: 'Courier New', Courier, monospace;">sudo update-initramfs -u </span><br />
<span style="background-color: #eeeeee; font-family: 'Courier New', Courier, monospace;"><br /></span>
...and rebooted without a hitch. Well actually, first I replaced it with pata-generic, which of course is very wrong and got dropped to busybox again. But I will never admit to that. ;)<br />
<br />
Also I must say that cupt feels a tad bit snappier than apt-get.<br />
<div>
<br /></div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-20120023662208068112013-04-21T07:34:00.001+02:002013-04-21T07:34:22.456+02:00Official update of CAMP time to rejoice!<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8ok6kl-MGC2Tvf-l7lXmJhj10nvjH28W7JzTD5iclVLnNglRFuRXmFoT87-b0axm96sUFueAGqx2Ej1OtwxqrQJ-M9lEJR7NNzCnsjLb9v5XQyJ2SY5onYbhcbEngd_5EqKPVec3APwnm/s1600/Camp_Main.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8ok6kl-MGC2Tvf-l7lXmJhj10nvjH28W7JzTD5iclVLnNglRFuRXmFoT87-b0axm96sUFueAGqx2Ej1OtwxqrQJ-M9lEJR7NNzCnsjLb9v5XQyJ2SY5onYbhcbEngd_5EqKPVec3APwnm/s400/Camp_Main.jpg" width="400" /></a></div>
<br />
Today (yesterday) I got an email from the author of CAMP who had found my efforts on getting his old software to work on newer systems. Much to my delight he also offered to do the updates required to get CAMP to work or rather play nice with modern compilers.<br />
<div>
<br /></div>
<div>
Anyway here's a link to the latest version: </div>
<div>
<a class="ot-anchor" href="http://www.sector7.nu/camp/camp-1.6.3744.tgz" rel="nofollow" style="color: #3366cc; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;">http://www.sector7.nu/camp/camp-1.6.3744.tgz</a></div>
<div>
<br />
This version compiles without any issues on my Crunchbang Waldorf system. Happy Camping!</div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-82674930021043797752013-03-14T17:46:00.000+01:002013-03-14T17:46:37.340+01:00Solder fume extractor<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0gdFKEPFPs7c0iX_jg3cUm6P13FanlRM9eVl4WHIAovn9CkEs6DIREyThx7eKJx5xU_qfp7tC_JMlUHlwD3DcH7zmsbvCeiq_3yPG9c9QSWhELo5PTryaBMEUuMq3CT8wjwLnrc0WGd90/s1600/CE78924A-58E6-4435-9FFF-CD13C7D29C35.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0gdFKEPFPs7c0iX_jg3cUm6P13FanlRM9eVl4WHIAovn9CkEs6DIREyThx7eKJx5xU_qfp7tC_JMlUHlwD3DcH7zmsbvCeiq_3yPG9c9QSWhELo5PTryaBMEUuMq3CT8wjwLnrc0WGd90/s400/CE78924A-58E6-4435-9FFF-CD13C7D29C35.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">12 V DC computer fan with grill, filter and a 2.1 mm DC connector. </td></tr>
</tbody></table>
<br />
Make's <a href="http://blog.makezine.com/2008/03/30/diy-fume-extractor-1/">Candy tin fume extractor</a> had me pestering friends and coworkers for 40 mm x 40 mm fans for a long time until I finally googled <a href="http://www.flickr.com/photos/15963424@N00/7406251308/">up this picture instead</a>. A bare bones solder fume extractor that I find a lot more appealing than the candy tin version. Even better it delivers more "suck" and I already had a suitable fan.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_vzqvRP8xkd0QH_5mY-M1JZiIcSqlK_mjpbDmPLw2vAR4zTNjj5Ta60wxjouQDRUZfVHPn1hUF87f0_VKVH5S4OHxCOOG6jR20Go6ypdxs2ss5B104bBQsVoo-gG3SFoPT_WoIxf_N05a/s1600/BE0A006C-BDAA-4A59-88EB-26335204102E.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_vzqvRP8xkd0QH_5mY-M1JZiIcSqlK_mjpbDmPLw2vAR4zTNjj5Ta60wxjouQDRUZfVHPn1hUF87f0_VKVH5S4OHxCOOG6jR20Go6ypdxs2ss5B104bBQsVoo-gG3SFoPT_WoIxf_N05a/s400/BE0A006C-BDAA-4A59-88EB-26335204102E.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I might paint it somewhere in the future. I think matte white would look<br />
pretty cool in contrast to the black fan, filter an cable. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-lFmBXmo3vjZkHPj74xyAVXQv9XVUc4XkT31nzIj2HfsV15OyS2kvSnzUWfhTY1TK2L-EXy8KswMCrDv7CQnhk8oCaF4eOStRj_as4h59JeRIlGg7M6n2oYE_ryWeP-JWImLTsvMrf5nY/s1600/AD6ACCD7-4E57-48A4-B1AC-8361A225E152.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-lFmBXmo3vjZkHPj74xyAVXQv9XVUc4XkT31nzIj2HfsV15OyS2kvSnzUWfhTY1TK2L-EXy8KswMCrDv7CQnhk8oCaF4eOStRj_as4h59JeRIlGg7M6n2oYE_ryWeP-JWImLTsvMrf5nY/s400/AD6ACCD7-4E57-48A4-B1AC-8361A225E152.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Filter side, yes it's missing one set of nut/bolt/washers. <br />
My idea about using the already rounded corner of the filter <br />
to my advantage turned out as a disadvantage. </td></tr>
</tbody></table>
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-5789586816574354622013-03-13T18:14:00.000+01:002013-03-13T18:14:40.492+01:00Breathing new life into a sluggish iBook G4Well maybe not as much new life. Let's call it an iBook G4 on dialysis, anyway the main objective was to erase and reinstall OSX 10.5 Leopard on my 12" iBook G4 1,33 GHz . Unfortunately my original DVD was "lost" so I had to go and find another solution.<br />
<br />
<h3>
Failure 1 - Burned image on DVD</h3>
I did try to burn a new DVD using an image of the original but that didn't pan out very well as the installation process got stuck in the verification phase. I did try to skip the verification process but that just left me with a totally unusuable system.<br />
<br />
<h3>
Failure 2 - External USB DVD </h3>
I moved on to trying to boot from an external USB DVD reader/writer using instructions I found at <a href="http://ben-collins.blogspot.se/2010/08/booting-your-ibook-g4-from-usb-stick.html">Ben Collins blog</a>. But for some reason my external USB DVD reader/writer just wouldn't show up in Open Firmware.<br />
<br />
<h3>
Success - Image on USB stick</h3>
When I was busy googling for options to get my external DVD functioning I briefly read something about USB sticks being friendlier in this scenario than a USB drive of some sort. So I used OSX's "Disk Utility" to write the aformentioned ISO image to a USB stick and went back to step 1 of Ben Collins instructions and success showed its pretty little face at step 4 i.e typing <span style="background-color: #eeeeee; font-family: Courier New, Courier, monospace;">boot ud:,\\:tbxi</span> in open firmware. From there on everything worked flawlessly. To get to open firmware press and hold <span style="background-color: #eeeeee; font-family: Courier New, Courier, monospace;">Command+Option+O+F</span> as soon as you power up your iBook.<br />
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/Rf2C2FgYyfU?feature=player_embedded' frameborder='0'></iframe></div>
<div>
<h3>
Apps?</h3>
The only problem was that many of the apps I had installed on my iBook now only supports Intel architecture. But I quickly realized I'm not alone! I found the <a href="http://www.powerpcsoftware.com/">Power PC Software Archive</a> a great collection with the latest release of many PPC apps on local mirrors. This means I that I once again can run Spotify on my iBook G4. Also I found the <a href="http://macpowerpc.com/">Mac PowerPC blog</a>, and the great great great app<a href="http://macapps.sakura.ne.jp/mactubes/index_en.html"> MacTubes</a>. Normally YouTube is out of the question on the old iBook, ok so I might get it to start but viewing pleasure is out of the question. MacTubes changes all that, now I can search, browse and play videos to my hearts desire with out any lag or out of sync audio what so ever.</div>
</div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com8tag:blogger.com,1999:blog-917542905889928199.post-89266630736548062802013-03-12T06:17:00.001+01:002013-03-12T08:13:03.264+01:00Shutdown Linux nicely with a USB stick the right wayForget everything I wrote in my previous post. Like Andrew pointed out in the comments on my <a href="http://youtu.be/j33E4Tn1YKA">youtube video</a> and the <a href="http://genericnerd.blogspot.se/2013/03/shutdown-linux-nicely-with-usb-stick.html?showComment=1362920387448#c6133175952190907648">blog</a>, running a cron job every minute isn't really optimal. There is <a href="http://askubuntu.com/questions/25071/how-to-run-a-script-when-a-distinct-flash-drive-is-mounted">a better way</a> to do it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://ytimg.googleusercontent.com/vi/qSX2fWE2_n8/0.jpg" height="266" width="320"><param name="movie" value="https://www.youtube.com/v/qSX2fWE2_n8?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="https://www.youtube.com/v/qSX2fWE2_n8?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<br />
<div>
The fun part is that it doesn't require autofs since it uses udev rules and can find out the id of a USB stick (or any other device I guess) upon connection instead of going through the mounting process. At the same time it also manages quite nicely renders my script obsolete since you can issue "shutdown -h now" directly. Oh, did mention it's A LOT faster. </div>
<div>
<h3>
Well enough with the talk here's how you do it: </h3>
</div>
<div>
Find out the vendorId and productId of your USB stick: </div>
<div>
$ lsusb</div>
<div>
Here's my output, the numbers you want are the ones after "ID" the first one is the vendorId and the latter productId:</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Bus 001 Device 003: ID 0781:7114 SanDisk Corp. Cruzer Mini</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub</span></div>
</div>
<div>
<br /></div>
<div>
Then create an aptly named file in: <span style="font-family: Courier New, Courier, monospace;">/etc/udev/rules.d/</span> I went with: <span style="font-family: Courier New, Courier, monospace;">100-usb-device-action.rules </span><br />
<br /></div>
<div>
Then add the following line, just substitute your vendorId and your productId</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">ACTION=="add", ATTRS{idVendor}=="0781", ATTRS{idProduct}=="7114", RUN+="/sbin/shutdown -h now"</span></div>
</div>
<div>
<br /></div>
<div>
That's it! Your done. Insert that USB device and watch your system shutdown in a nice way. </div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com2tag:blogger.com,1999:blog-917542905889928199.post-68292743543144646982013-03-10T08:23:00.003+01:002013-03-12T06:23:06.751+01:00Shutdown Linux nicely with a USB stick<h2>
PLEASE NOTE</h2>
This post is sort obsolete since there is another way to shutdown linux nicely that requires less of everything. You can <a href="http://genericnerd.blogspot.com/2013/03/shutdown-linux-nicely-with-usb-stick_12.html">read about it here</a>. However maybe you came for the script that looks for a file and issues a command. Well then you're in the right place, just scroll down a bit.<br />
<br />
<h3>
Shutdown Linux nicely with a USB stick</h3>
If I had such a thing like a following from regular readers you would probably know about my ancient Toshiba Satellite 320CDS laptop that now serves as a digital picture frame. The only problem is to have it shut down properly.<br />
<br />
Why is that a problem you ask?<br />
Well, I can't use the power button as it just cuts the power and I risk getting disk errors that most likely forces me to hook up a keyboard on the next boot. Something that I rather avoid.<br />
But I can do it via a ssh connection. However that requires a working network connection and another device. That leaves me with the option I'd rather avoid. Connecting a keyboard and manually shutting the system down. Ok, not the end of the world but it's a bit tedious to have to drag out a keyboard each time I want to do a shut down.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/j33E4Tn1YKA?feature=player_embedded' frameborder='0'></iframe></div>
<br />
My solution for this is a script that checks if a certain file is present in a defined directory. If the file is present the script issues the "<span style="font-family: Courier New, Courier, monospace;">shutdown -h now</span>" command. The physical part of this is that the file is contained on a USB stick that when inserted automounts to a certain location. By running the script from root's crontab I now have a way to make Linux shut down nicely without a working network connection or keyboard.<br />
<br />
<h3>
Howto: Shutdown Linux nicely with a USB stick </h3>
So what is needed for this to work? Well first of all <a href="https://github.com/makkan77/executeOnSight.git">here's my script</a>. It's not very complicated and you should be able to tailor it according to your needs. Perhaps you want to run a slideshow with the pictures on a USB stick when inserted or maybe even completely wipe your system.<br />
<br />
The next step is to make a USB stick automount in a certain directory.<br />
For this we need to install autofs. There's good <a href="http://wiki.debian.org/AutoFs">tutorial on this here</a> and <a href="http://greenfly.org/tips/autofs.html">here</a>, but I'll give you the basics below.<br />
<br />
Since I run debian installation is as easy as:<br />
<span style="font-family: 'Courier New', Courier, monospace;">$</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">sudo apt-get install autofs </span><br />
<br />
To configure autofs I started by adding this line to <span style="font-family: Courier New, Courier, monospace;">/etc/auto.master</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/media /etc/auto.removable --timeout=2</span><br />
<br />
Then I added this line to /etc/auto.removable<br />
<span style="font-family: Courier New, Courier, monospace;">usb-shutdown <span class="Apple-tab-span" style="white-space: pre;"> </span>-fstype=ext2<span class="Apple-tab-span" style="white-space: pre;"> </span>UUID=UUIDOFYOURDEVICE</span><br />
<br />
The UUID is the <a href="http://en.wikipedia.org/wiki/Universally_unique_identifier">Universally unique identifier</a> of a disk. In this case we use it as way to know what USB stick to mount in <span style="font-family: Courier New, Courier, monospace;">/media/usb-shutdown/</span><br />
You can find out the UUID of your device with:<br />
<span style="font-family: 'Courier New', Courier, monospace;">$</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">ls -la /dev/disk/by-uuid/ </span><br />
<br />
This will give you a list of your devices with symlinks pointing to their labels i.e <span style="font-family: Courier New, Courier, monospace;">/dev/sda1</span> etc. Alternatively you could run the following command, substituting <span style="font-family: Courier New, Courier, monospace;">/dev/sda1</span> to your device. <br />
<span style="font-family: 'Courier New', Courier, monospace;">$</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">sudo blkid /dev/sda1</span><br />
<br />
Finally to make autofs recognize your changes run:<br />
<span style="font-family: Courier New, Courier, monospace;">$ /etc/init.d/autofs restart</span><br />
<br />
Last but not least we have to make the script run at a certain interval. This is done via the cron daemon. To edit root's crontab type following, if you want to edit the current user's crontab just omit the "sudo":<br />
<span style="font-family: Courier New, Courier, monospace;">$ sudo crontab -e</span><br />
<br />
Add the following lines:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"># Check if USB device with "systemHaltNow" is present</span><br />
<span style="font-family: Courier New, Courier, monospace;"> * * * * * /PATH/yourscript.sh >/dev/null 2>&1</span><br />
<div>
<br /></div>
<div>
The stars tell cron to run the script once every minute forever and ever and ever. The last part stops cron from e-mailing you and logging everytime it executes the script, <a href="http://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/">more info on that here</a>.</div>
<br />
Well that's it.<br />
<div>
<br /></div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com2tag:blogger.com,1999:blog-917542905889928199.post-28216812212312980062013-03-08T17:14:00.000+01:002013-03-08T17:14:28.199+01:00Big wall mounted buttonsHere's a little unfinished project that got trashed during my last relocation. Rather than playing around with LEDs and sensors this project is actually based on the idea to be both visually appealing and functional. The plan was to make a sort of interface to a media player such as iTunes or Spotify with the use of the Arduino and a proxy like <a href="http://mikmo.dk/gobetwino.html">Gobetwino</a> or (the apparently now dead) ASproxy from (the equally dead) Tinker.it.<br />
<br />
Since it's been on ice for quite some time, well actually in this case it rather got "iced" in the mafia sense of the word, I thought it was about time to share the concept of the project.<br />
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhajTFxwO8aN8BNxhYL6PJsq-M6ba3P1Yvyvp8H39v6JmVW_q09FfGzgW7OF_UmmYG_4PkT1GSAhSfN0RjfG3ZzvJLsxQg_yxRl6j74ES45aCQZrreys72JIRWgR7EJz5DRkD5ldIj9abiZ/s1600-h/connection_buttons.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhajTFxwO8aN8BNxhYL6PJsq-M6ba3P1Yvyvp8H39v6JmVW_q09FfGzgW7OF_UmmYG_4PkT1GSAhSfN0RjfG3ZzvJLsxQg_yxRl6j74ES45aCQZrreys72JIRWgR7EJz5DRkD5ldIj9abiZ/s320/connection_buttons.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Step 1. Cut shapes of the buttons in a foam of choice.</td></tr>
</tbody></table>
</div>
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd567dANcjH41FD2HiSxQuKTbJdL7fea9AKevDeN9ExtCcabfQ2SCv2BNahLx2lmn7OjpMMClO4XI_-ze0h0-1fwPkrnnsn58C0ZIEZB0d9JnPrAw6FhMOOIp1cIIFx9F0Z6PDGQ5_cnED/s1600-h/connection_closeup.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd567dANcjH41FD2HiSxQuKTbJdL7fea9AKevDeN9ExtCcabfQ2SCv2BNahLx2lmn7OjpMMClO4XI_-ze0h0-1fwPkrnnsn58C0ZIEZB0d9JnPrAw6FhMOOIp1cIIFx9F0Z6PDGQ5_cnED/s320/connection_closeup.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Step 2. Glue some foil on the back of the buttons and scotch taped a wire<br />
or solder if you're awesome at that.</td></tr>
</tbody></table>
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlOL93yJNlJ-6Rsd8q4JKD9ywCTwpoFJkTHE97C4MZEmGnuCE4G67zYyqbVNwSE6m3xjQN264j3bg2FqNjEqsmHX7dbYf-wIhyphenhyphen4V343aK5Wk27g6MhXzKCRpQSymAL44yQo-O0UUEYa8AM/s1600-h/buttons_topview.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlOL93yJNlJ-6Rsd8q4JKD9ywCTwpoFJkTHE97C4MZEmGnuCE4G67zYyqbVNwSE6m3xjQN264j3bg2FqNjEqsmHX7dbYf-wIhyphenhyphen4V343aK5Wk27g6MhXzKCRpQSymAL44yQo-O0UUEYa8AM/s320/buttons_topview.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Step 3. Paint the buttons in a nice color. </td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGO0oNCcBYltiuRpDB_UPy_D0mS3MWYfMjUfbWKCxMjIA0A2qRQIOljGcjK0nTJrMRnJn7BsWbA-M4VSHvL6rCQnubOeFr-68zqAPecql0nwWE4z7yf35tqbMBZeG8_364bRBkF28LG0NW/s1600-h/buttons_threequarterview.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGO0oNCcBYltiuRpDB_UPy_D0mS3MWYfMjUfbWKCxMjIA0A2qRQIOljGcjK0nTJrMRnJn7BsWbA-M4VSHvL6rCQnubOeFr-68zqAPecql0nwWE4z7yf35tqbMBZeG8_364bRBkF28LG0NW/s320/buttons_threequarterview.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Yeah, I never really got around to step 3. </td></tr>
</tbody></table>
<br />
When I started out my intention was to make a simple circuit and a button that either breaks or closes a circuit. But then I started dabbling with capacitive sensing, hence just the one wire in the pictures.<br />
<div>
<br /></div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-38147477846321873972013-03-05T13:25:00.001+01:002013-03-05T13:27:56.793+01:00shairport on 233 MHz, a success storyWell like the title says <a href="https://github.com/albertz/shairport">shairport </a>works quite nice with really old hardware and I do think 16 years qualifies as really old when it comes to computers.<br />
<br />
Here's the specs:<br />
<b>Toshiba Satellite 320CDS<br />CPU</b>: 233 Mhz Pentium MMX<br />
<b>RAM</b>: 96 MB<br />
<b>HDD</b>: SandDisk Compact Flash 8 GB Extreme IV via Lycom CF 2 IDE Bridge<br />
<b>OS</b>: Debian Gnu/Linux Squeeze<br />
<br />
When streaming music from iTunes shairport uses about 38% CPU, quite a lot compared to mpg123 that only draws 10 % CPU. But really I'm just impressed that it works. When it comes to RAM shairport uses roughly 4 % of my available 95 MB.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmzmufhhbCUDjXrLbjUMV-fQa1ypdjWsCs9RKlrt7CE8yiWZFIO7XViccLXNXzGt-zjc40QyPJ8ifbheWOHC0wg8UiLwkXbus8kpNImDYcUgrHXzQOQBQ1jmVFcNbp3U7ncGbM9q-bR_sq/s1600/top_shairport.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmzmufhhbCUDjXrLbjUMV-fQa1ypdjWsCs9RKlrt7CE8yiWZFIO7XViccLXNXzGt-zjc40QyPJ8ifbheWOHC0wg8UiLwkXbus8kpNImDYcUgrHXzQOQBQ1jmVFcNbp3U7ncGbM9q-bR_sq/s400/top_shairport.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The output of shairport isn't really that much fun <br />
to look at so here's a screenshot of top instead. </td></tr>
</tbody></table>
<br />
I'm not going to tell you how to do it. That's pretty much <a href="http://trouch.com/2012/08/03/airpi-airplay-audio-with-raspberry/">covered here</a>.<br />
<br />
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-89732748902405914982013-02-28T15:57:00.000+01:002014-03-14T13:11:59.233+01:00CAMP - Console Ansi Mpeg3 Player<br />
<h4>
PLEASE NOTE: An official update of CAMP as of April 20 2013 <a href="http://www.sector7.nu/camp/camp-1.6.3744.tgz">is available here</a>.</h4>
<br />
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8ok6kl-MGC2Tvf-l7lXmJhj10nvjH28W7JzTD5iclVLnNglRFuRXmFoT87-b0axm96sUFueAGqx2Ej1OtwxqrQJ-M9lEJR7NNzCnsjLb9v5XQyJ2SY5onYbhcbEngd_5EqKPVec3APwnm/s1600/Camp_Main.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8ok6kl-MGC2Tvf-l7lXmJhj10nvjH28W7JzTD5iclVLnNglRFuRXmFoT87-b0axm96sUFueAGqx2Ej1OtwxqrQJ-M9lEJR7NNzCnsjLb9v5XQyJ2SY5onYbhcbEngd_5EqKPVec3APwnm/s400/Camp_Main.jpg" height="240" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP 1.5.3489 Console ANSI Mpeg3 Player (Rawlock skin).</td></tr>
</tbody></table>
<br />
Years ago I came across a really nice front end for mpg123 called <a href="http://sector7.nu/camp/">CAMP</a> by Sector7's inm. I fell in love with it at first sight. Why, well because I love ANSI art! So recently when I started drifting towards creating a console only GNU/Linux system I had this little gem in the back of my head.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHdRxbmIprgU6ugLAyXxdsfW4ry65awVcbhNIa4kVNK6PWDCzousQZBPtuezObH3WsYCvyc0SbAaM7iidqogNlL4RB6KbgerxEL2jr9vr8sOQAakv-K4LfrnHG9N5mELtWq9tMD_SCRYYK/s1600/Camp_File.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHdRxbmIprgU6ugLAyXxdsfW4ry65awVcbhNIa4kVNK6PWDCzousQZBPtuezObH3WsYCvyc0SbAaM7iidqogNlL4RB6KbgerxEL2jr9vr8sOQAakv-K4LfrnHG9N5mELtWq9tMD_SCRYYK/s400/Camp_File.jpg" height="240" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP File selector (Rawlock skin).</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYPrF0igOIduslgOXEGIzh0qEMeUiW7zsy_zGDMD3Zy6xgyA9QLHIDCvBGZqfow87gBlopIF_9bMyyW-4tQDZFdrIkCFPhp4PeTC-eZHIhvvqszgi-jFCYElWr3fpMscmVdiCwXT2iCLeZ/s1600/Camp_Desc.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYPrF0igOIduslgOXEGIzh0qEMeUiW7zsy_zGDMD3Zy6xgyA9QLHIDCvBGZqfow87gBlopIF_9bMyyW-4tQDZFdrIkCFPhp4PeTC-eZHIhvvqszgi-jFCYElWr3fpMscmVdiCwXT2iCLeZ/s400/Camp_Desc.jpg" height="240" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP Description editor (Rawlock skin).</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrI3aW-tPjilUw8_B3q3brf2KESLY60DwfRg9vTn_ck83l7SNd19dt1ABWixBtvM0xcUtaRraeI7IxCqd3Rm1xxBNUXOLtWr_NRTlAjHKmF0Kuv4KDZMd_HCI3FDcextIiY4RHJi4dahTW/s1600/Camp_Fork.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrI3aW-tPjilUw8_B3q3brf2KESLY60DwfRg9vTn_ck83l7SNd19dt1ABWixBtvM0xcUtaRraeI7IxCqd3Rm1xxBNUXOLtWr_NRTlAjHKmF0Kuv4KDZMd_HCI3FDcextIiY4RHJi4dahTW/s400/Camp_Fork.jpg" height="240" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP Forked to background.</td></tr>
</tbody></table>
<br />
<br />
I had to think hard (google) to actually remember the name of the app but luckily enough the website was (and is) still alive. Sadly the last update was in 2002. But hey! Maybe it didn't need more coding?<br />
<br />
Or did it? Compilation gave me heaps of errors. Errors I first regarded as something way above my level of competence. Here's a few lines:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">fork.c:120: error: too few arguments to function ‘exit’</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">fork.c: In function ‘stealback’:</span><br />
<span style="font-family: Courier New, Courier, monospace;">fork.c:137: warning: incompatible implicit declaration of built-in function ‘exit’</span><br />
<span style="font-family: Courier New, Courier, monospace;">fork.c:137: error: too few arguments to function ‘exit’</span><br />
<span style="font-family: Courier New, Courier, monospace;">fork.c:146: warning: incompatible implicit declaration of built-in function ‘exit’</span><br />
<span style="font-family: Courier New, Courier, monospace;">fork.c:150: warning: incompatible implicit declaration of built-in function ‘exit’</span><br />
<span style="font-family: Courier New, Courier, monospace;">fork.c:188: warning: incompatible implicit declaration of built-in function ‘exit’</span><br />
<span style="font-family: Courier New, Courier, monospace;">fork.c:188: error: too few arguments to function ‘exit’</span><br />
<div>
<br /></div>
<br />
I started out by mailing the author but as of now I've still haven't heard from him or her. Then again I'm not really expecting someone to jump at troubleshooting their eleven year old code as soon as random idiot from the internet e-mails them about it. So I turned my questions to the mighty google instead.<br />
<br />
I quickly learned that the errors were quite easily remedied:<br />
<span style="font-family: 'Courier New', Courier, monospace;">error: too few arguments to function ‘exit’</span><br />
All the instances of <span style="font-family: Courier New, Courier, monospace;">exit()</span> in <span style="font-family: Courier New, Courier, monospace;">fork.c</span> needed to be replaced with <span style="font-family: Courier New, Courier, monospace;">exit(0)</span>.<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">warning: incompatible implicit declaration of built-in function ‘exit’</span><br />
Add <span style="font-family: Courier New, Courier, monospace;">#include </span><span style="font-family: Arial, Helvetica, sans-serif;"><</span><span style="font-family: Courier New, Courier, monospace;">stdlib.h</span><span style="font-family: Arial, Helvetica, sans-serif;">></span> to the top of <span style="font-family: Courier New, Courier, monospace;">fork.c</span><br />
<br />
After this the code will compile but still generates heaps of warnings. I've compiled a list of errors and remedies if you want a warning free compile, or you could just download my pre-fixed package further down.<br />
<br />
<h3>
How to download, make and install CAMP:</h3>
0 Install the dependencies <br />
<span style="font-family: Courier New, Courier, monospace;">$ sudo apt-get install zlib1g-dev mpg123</span><br />
<span style="font-size: x-small;">Note: First time I tried to compile CAMP on my Debian box I never had any issues with dependencies. </span><span style="font-size: x-small;">Well except mpg123 since that is what CAMP is a front end for. </span><span style="font-size: x-small;">If you do find any missing deps please comment and I'll add them to the list above. </span><br />
<br />
1a. Get the latest code :<br />
<span style="font-family: Courier New, Courier, monospace;">$ wget -c http://sector7.nu/camp/camp-1.5.3589.tar.gz</span><br />
<br />
<span style="background-color: lime;">PLEASE NOTE: An official update of CAMP as of April 20 2013 is now available. </span><br />
<span style="font-family: Courier New, Courier, monospace;">$ wget -c http://www.sector7.nu/camp/camp-1.6.3744.tgz</span><br />
<br />
1b. Alternatively download my updated code that works for me.<br />
<span style="font-family: Courier New, Courier, monospace;">$ wget -c https://www.dropbox.com/s/510hdr4g3mutb5p/camp-1.5.3589_makkan.tar.gz</span><br />
<br />
2. Unpack the downloaded file.<br />
<span style="font-family: Courier New, Courier, monospace;">$ tar xvzf camp-1.5.3589.tar.gz</span><br />
<br />
3. Configure CAMP<br />
<span style="font-family: Courier New, Courier, monospace;">$ ./configure</span><br />
<br />
4. Compile and install CAMP<br />
<span style="font-family: Courier New, Courier, monospace;">$ ./make && sudo make install</span><br />
<br />
5. Install the skins <br />
<span style="font-family: Courier New, Courier, monospace;">$ ./make install-skins </span><br />
Note: This installs the skins in ~/.camp/skins but for some reason the individual skin dirs are not executable i.e not possible to cd into. But it can easily be fixed by issuing:<br />
<span style="font-family: Courier New, Courier, monospace;">$ chmod ug+x * </span><br />
in HOME/.camp/skins/<br />
<br />
6. Configure CAMP, start by copying <span style="font-family: Courier New, Courier, monospace;">camp.ini</span> from the source code directory to your home <span style="font-family: Courier New, Courier, monospace;">.camp/</span> dir<br />
<span style="font-family: Courier New, Courier, monospace;">$ cp camp.ini ~/.camp/camprc</span><br />
Then edit the camprc according to your preferences e.g location of mpg123, audio output etc. <br />
<br />
7. run CAMP!<br />
<span style="font-family: Courier New, Courier, monospace;">$ camp</span><br />
<br />
<h3>
Hey! Why does everything look like crap in Virtual console?</h3>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7gtBIOpUuTU4dxrL_GDhSPEBKf3pPpy8XgWbGTxN22j1Z88enj-MgwxC1MUgth3-493WZsPMB6aSwA43v8NtBZ3oik1SngZd-xu9zZH-OxJhyRS0mQuSOjDR6FiVfohDisz0k_juOHMhi/s1600/camp-sv_E.ISO-8859-15.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="CAMP in console with $TERM Linux and locale sv_SE.ISO-8859-15" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7gtBIOpUuTU4dxrL_GDhSPEBKf3pPpy8XgWbGTxN22j1Z88enj-MgwxC1MUgth3-493WZsPMB6aSwA43v8NtBZ3oik1SngZd-xu9zZH-OxJhyRS0mQuSOjDR6FiVfohDisz0k_juOHMhi/s1600/camp-sv_E.ISO-8859-15.png" height="300" title="CAMP Screenshot" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP in console with $TERM Linux and locale sv_SE.ISO-8859-15</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9H_BOxfxmmCEnegO0ik9M8xzHSZlUQ_zqq5lnUuTSCixYPRgNcZoVeYzc5aTRPm7xNA4yEYYydA_Iwxeckh9tN7OKhrZqxSu39euGRdMBZ0AK5LnpL3_yuy6XPR4hzgL4_soHujD4SZmO/s1600/camp-sv_SE.UTF-8.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="CAMP in console with $TERM Linux and locale sv_SE.UTF-8" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9H_BOxfxmmCEnegO0ik9M8xzHSZlUQ_zqq5lnUuTSCixYPRgNcZoVeYzc5aTRPm7xNA4yEYYydA_Iwxeckh9tN7OKhrZqxSu39euGRdMBZ0AK5LnpL3_yuy6XPR4hzgL4_soHujD4SZmO/s1600/camp-sv_SE.UTF-8.png" height="300" title="CAMP Screenshot" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP in console with $TERM Linux and locale sv_SE.UTF-8</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: start;">
<br /></div>
<div style="text-align: start;">
Well I've found a way to temporarily remedy this. Although I'm still researching better solutions. The one I have right now is to use one of the following settings: </div>
<div style="text-align: start;">
<span style="font-family: Courier New, Courier, monospace;">$ charset G0 cp437</span></div>
<div style="text-align: start;">
<span style="font-family: Courier New, Courier, monospace;">$ charset G1 cp437</span></div>
<div style="text-align: start;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: start;">
<span style="font-family: inherit;">If for some reason your console turns out unreadable you can always go back with. Se more in the charset manpages.</span></div>
<div style="text-align: start;">
</div>
<span style="font-family: Courier New, Courier, monospace;">$ charset G0 iso01</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ charset G1 iso01</span><br />
<br />
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj05F4Y65Mv92n1MqB6PS21BM3d2a8oqBu_-cphaYLhyphenhyphen6WTQrq19fOOVzc695-KGU0E_UHUgHaiZ8oWrp7agXri0HVlKyYn4amaUDHJy_0yTV1FHRtqiyDLy_jALxlm1-rmM8NS-htuUA6U/s1600/camp_working.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="CAMP in console with $TERM Linux, locale sv_SE.UTF-8 and charset cp437" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj05F4Y65Mv92n1MqB6PS21BM3d2a8oqBu_-cphaYLhyphenhyphen6WTQrq19fOOVzc695-KGU0E_UHUgHaiZ8oWrp7agXri0HVlKyYn4amaUDHJy_0yTV1FHRtqiyDLy_jALxlm1-rmM8NS-htuUA6U/s400/camp_working.png" height="300" title="CAMP screenshot" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CAMP in console with $TERM Linux, locale sv_SE.UTF-8<br />
and charset cp437</td></tr>
</tbody></table>
<br />
<h3>
Hey! Why does everything look like crap in PuTTY?</h3>
<br />
This one's easy. Just set the remote character set to the ISO-8859-X that suits you or type in CP850. It's under Window>Translation<br />
<br />
<h3>
Hey! Why does everything look like crap in PuTTY when I use GNU screen?</h3>
<br />
This one's easy. Just set the remote character set to the ISO-8859-X that suits you or type in CP850. It's under Window>Translation<br />
And do the following:<br />
<br />set $LANG to C</div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">$</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">export LANG=C
</span><br /><br />In screen set c1 to off: </div>
<div>
Press<span style="font-family: Courier New, Courier, monospace;"> crtl+a+: </span>and type <span style="font-family: Courier New, Courier, monospace;">c1 off</span> </div>
<div>
<br />and set UTF8 to off: </div>
<div>
Press <span style="font-family: Courier New, Courier, monospace;">crtl+a+: </span>and <span style="font-family: Courier New, Courier, monospace;">type utf8 off off</span><br /><br />
<div>
Found these GNU Screen tricks in the amnesia/epic documentation <a href="http://amnesiac.ircii.org/doc/NOTES">here</a>. </div>
<br />
<br />
<h3>
Hey! Why does everything look like crap in xterm?</h3>
<br />
Don't know haven't had this problem yet. Hint might be to try something of the above.<br />
<br />
<br />
<h3>
Short description of warnings and remedies when trying to compile CAMP: </h3>
<span style="font-family: Courier New, Courier, monospace;">warning: incompatible implicit declaration of built-in function ‘strcpy’</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">warning: incompatible implicit declaration of built-in function ‘strlen’</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">warning: incompatible implicit declaration of built-in function ‘strncat’</span><br />
<div>
<br />
<span style="font-family: Courier New, Courier, monospace;">warning: incompatible implicit declaration of built-in function ‘strchr’</span><br />
Add <span style="font-family: Courier New, Courier, monospace;">#include </span><span style="font-family: Arial, Helvetica, sans-serif;"><</span><span style="font-family: Courier New, Courier, monospace;">string.h</span><span style="font-family: Arial, Helvetica, sans-serif;">></span><span style="font-family: Courier New, Courier, monospace;"> </span>to the top of the offending file.<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span style="font-family: 'Courier New', Courier, monospace;">warning: incompatible implicit declaration of built-in function ‘exit’</span><br />
Add <span style="font-family: Courier New, Courier, monospace;">#include </span><span style="font-family: Arial, Helvetica, sans-serif;"><</span><span style="font-family: Courier New, Courier, monospace;">stdlib.h</span><span style="font-family: Arial, Helvetica, sans-serif;">></span> to the top of the offending file.<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">warning: incompatible implicit declaration of built-in function ‘printf’</span><br />
Add <span style="font-family: Courier New, Courier, monospace;">#include </span><span style="font-family: Arial, Helvetica, sans-serif;"><</span><span style="font-family: Courier New, Courier, monospace;">stdio.h</span><span style="font-family: Arial, Helvetica, sans-serif;">></span><span style="font-family: Courier New, Courier, monospace;"> </span>to the top of the offending file.<br />
<div>
<br /></div>
</div>
<br /></div>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com4tag:blogger.com,1999:blog-917542905889928199.post-75271213545907662912013-02-27T17:27:00.000+01:002013-09-04T08:51:30.377+02:00Reducing disk writes by putting /var/log in RAM (tmpfs)<h4>
**UPDATED 2013-03-01</h4>
I've recently grown quite fond of my old <a href="http://genericnerd.blogspot.se/2009/04/installing-linux-on-toshiba-satellite.html">Toshiba Satellite</a>* that currently exists in the form of a <a href="http://genericnerd.blogspot.se/2009/05/converting-toshiba-320cds-to-digital.html">digital picture frame</a>. I'm still not sure what to do with it but I've started exploring the possibilities of removing xorg completely and focusing solely on a command line interface.<br />
<br />
First thing is that I want to make it more robust, i.e. protect the CF-card from excessive disk writes and possible power failure. I could go with a dedicated dist such as Slitaz, Puppy or Tiny Core but I kind of like my own debian system. So I decided to go with reducing disk writes.<br />
<br />
I've taken a few steps to reduce disk writes already. But then there is the never ending logging. So I took some of my precious RAM and put <span style="font-family: Courier New, Courier, monospace;">/var/log</span> in it. I found some <a href="http://wiki.geteasypeasy.com/How_to:_Reduce_Disk_Writes_to_Prolong_the_Life_of_your_Flash_Drive">instructions on that here</a>.<br />
<br />
To accomplish this I added the following line in <span style="font-family: Courier New, Courier, monospace;">/etc/fstab</span><br />
<span style="font-family: Courier New, Courier, monospace;">tmpfs /var/log</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">tmpfs</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">size=4M,defaults,noatime,mode=0755</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">0</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: Courier New, Courier, monospace;">0</span><br />
<br />
So far I'm only using 4 MB but I could probably lower this. I just need to keep it running for a while and see how logrotate works.<br />
<br />
To prevent the 4 MB of log space to fill up uncontrollably I've configured logrotate from the default weekly rotation of logs to daily rotation and keeping only 1 day of backlog. I also added a size limit to each log file to 100k. But as far as "man logrotate" tells me this won't affect the logs more than once daily as the logrotate cron job only runs once each day.<br />
<br />
As of now I've edited <span style="font-family: Courier New, Courier, monospace;">/etc/logrotate.conf</span> accordingly.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"># rotate log files daily</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">daily</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"># keep 2 days worth of backlogs</span><br />
<span style="font-family: Courier New, Courier, monospace;">rotate 2</span><br />
<div>
<br />
<br />
<h4>
**PLEASE NOTE! </h4>
The above had little effect on my running system. Turns out many of the logs had separate instructions in:<span style="font-family: Courier New, Courier, monospace;">/etc/logrotate.d</span><br />
Update them accordingly and you should be in business.<br />
<br />
<br /></div>
* Toshiba Satellite 320CDS<br />
<b>CPU</b>: 233 Mhz Pentium MMX<br />
<b>RAM</b>: 96 MB<br />
<b>HDD</b>: SandDisk Compact Flash 8 GB Extreme IV via Lycom CF 2 IDE Bridge<br />
<b>OS</b>: Debian Gnu/Linux Squeeze<br />
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-56906677417464756212013-02-27T09:46:00.001+01:002013-02-27T09:46:51.780+01:00What time is it?For some reason I can't use PTT Twitter anymore so I started to look around for another console based twitter client. I found TTYtter. However I ran in to problems with the time being way off on my Digital Picture Frame. Probably because I haven't bothered to set it at all.<br />
<br />
<br />
<a href="http://www.linuxselfhelp.com/quick/clock.html">http://www.linuxselfhelp.com/quick/clock.html</a>
<br />
<a href="http://wiki-old.unix.se/NTP.html">http://wiki-old.unix.se/NTP.html</a>
<br />
<br />
<a href="http://wiki-old.unix.se/Cron.html">http://wiki-old.unix.se/Cron.html</a>
Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-45255634649496370272013-01-23T13:32:00.000+01:002013-03-08T15:47:02.023+01:00Programming an Arduino standalone ATmegaAt first I programmed my ATmega328 chips by pulling them from my circuit and placing them in one of my original Arduino boards. Something that is fun once or twice but gets really annyoing when you do it alot. So working from <a href="http://arduino.cc/en/Main/Standalone">this tutorial</a> I added some female headers to the circuit, dug out my trusty old <a href="https://www.sparkfun.com/products/718?">SparkFun FT232RL</a> breakout board, a 0.1uF capacitor and some jumper cables.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-OVcLGWP9Qrw/UMsSoKOAU_I/AAAAAAAAg3c/bu9gPNlsiuw/s1600/0244B469-EDF1-4DFD-AFF0-B1AD954525EC.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://2.bp.blogspot.com/-OVcLGWP9Qrw/UMsSoKOAU_I/AAAAAAAAg3c/bu9gPNlsiuw/s400/0244B469-EDF1-4DFD-AFF0-B1AD954525EC.JPG" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New female headers added to the RST, RX, TX, +V and GND pins.<br />
The circular thing in the upper left corner is a RF Transmitter module. </td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx3f-t7uCs32Xwf3d5b52yWXiIA-I8pIDPpQHwTQHQzRYv6mS9nfmqWkKV_6IaxtdEMEB6Bi5HL2DCWaPp1q645YaIzE5FgJBG96JXEZbPfBmxeJHsMNXWFY0MIMyjajv3PbTs0UtB7EBT/s1600/0850A727-FF54-437B-9CE5-C5E6ABA3185E.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx3f-t7uCs32Xwf3d5b52yWXiIA-I8pIDPpQHwTQHQzRYv6mS9nfmqWkKV_6IaxtdEMEB6Bi5HL2DCWaPp1q645YaIzE5FgJBG96JXEZbPfBmxeJHsMNXWFY0MIMyjajv3PbTs0UtB7EBT/s400/0850A727-FF54-437B-9CE5-C5E6ABA3185E.JPG" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The Sparkfun FT232RL break out board. </td></tr>
</tbody></table>
<br />
I usually placed the FT232RL break out board on a breadboard hooked up jumper cables to the corresponding pins of the ATmega. Recently I built a quick n' dirty jig with headers to hold the break out board and permanently soldered jumper cables.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBdRv2Klhk0xqrThEQj-fcYfeZKZIPBeSHkxExvcv5udzl1pHu5odLSu24yjCq5l_bwYySYAj8Ooh7fvSN3LZTRUVkcSHb60zkSQzj1qH6lq9mgXo_qU5zubE6TQsXWlflmjzF3MLsewj9/s1600/394FD4BC-26F3-4754-9B56-09F0201EF389.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBdRv2Klhk0xqrThEQj-fcYfeZKZIPBeSHkxExvcv5udzl1pHu5odLSu24yjCq5l_bwYySYAj8Ooh7fvSN3LZTRUVkcSHb60zkSQzj1qH6lq9mgXo_qU5zubE6TQsXWlflmjzF3MLsewj9/s320/394FD4BC-26F3-4754-9B56-09F0201EF389.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: x-small;"><span style="text-align: start;">You can see more pictures and read about the build </span><a href="http://genericnerd.blogspot.se/2013/01/ftdi-shieldjig-for-stand-alone-atmega.html" style="text-align: start;">here</a></span></td></tr>
</tbody></table>
This saves me the use of a breadboard and the tedious task of having to flip the FT232RL over numerous times to check and double check the connections.<br />
<br />
<h3>
Issues: </h3>
<span style="font-family: Courier New, Courier, monospace;">avrdude: stk500_getsync(): not in sync: resp=0x1e</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
In Arduino IDE I used the board "Duemilanove w/ ATmega328" but kept getting the above error message. At this point I hadn't added the 0.1uF capacitor in series with the DTR pin on the FT232RL to the Reset pin on the ATmega328 so when I googled the error code and found <a href="http://arduino.cc/forum/index.php/topic,27953.0.html">this post</a> it was the first thing I added. But things still wouldn't work. Until I changed my board to "Arduino Uno". After that everything worked like a charm.<br />
<br />
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-7135345202327110112013-01-23T13:06:00.000+01:002013-03-08T15:47:02.034+01:00FTDI shield/jig for stand alone ATmega<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;">Made a Quick n' dirty jig to fit my Sparkfun FT232RL break out board. I found it a tad bit annoying to always having to unplug and flip board to check and double check the connectors when uploading new code to stand alone ATmega projects.</span><br style="background-color: white; line-height: 18px;" /><br />Basically it brings out the VCC, GND, RXD, TXD and DTR (via a 0.1 uF cap) pins to jumper cables. <br style="background-color: white; line-height: 18px;" /><span style="background-color: white; line-height: 18px;">I'll probably add some labels later.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcwtH_ieMkLChpHNeurLcDPRPZ1bbXOtFT2LbW1R1FnuBPbJ5xEMiQeaGDOFrKB5cz4LZTCrGC2kPxg_zKQA7jEgAwR-_95X4VDgSiN_Gi-Z4NgHU_B89FYCmGFmEmx9QujpDwXXXS30M5/s1600/5F12B746-1836-45C9-A975-4A54E6EC1490.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="font-family: Arial, Helvetica, sans-serif;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcwtH_ieMkLChpHNeurLcDPRPZ1bbXOtFT2LbW1R1FnuBPbJ5xEMiQeaGDOFrKB5cz4LZTCrGC2kPxg_zKQA7jEgAwR-_95X4VDgSiN_Gi-Z4NgHU_B89FYCmGFmEmx9QujpDwXXXS30M5/s400/5F12B746-1836-45C9-A975-4A54E6EC1490.JPG" width="300" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">One end of the jumper cables permanently soldered to the jig and the other end resting in the perfboard holes.</span></td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD_UvaTQbNhIwZNYctCbAt9TaUNCPRPgEKPJXuNGyUgR5f8W3uegvN0nuvb8bPZvfNPmF0Un_t8DMdW9BiS2d0IeKoaSMxhbhpGq-CNXjGzrBivTzFgKPtbcQxrlE7FQ4K3qJqQFxbkN2n/s1600/E95CE1EC-B15C-47CB-84DB-579C248A2DCA.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="font-family: Arial, Helvetica, sans-serif;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD_UvaTQbNhIwZNYctCbAt9TaUNCPRPgEKPJXuNGyUgR5f8W3uegvN0nuvb8bPZvfNPmF0Un_t8DMdW9BiS2d0IeKoaSMxhbhpGq-CNXjGzrBivTzFgKPtbcQxrlE7FQ4K3qJqQFxbkN2n/s400/E95CE1EC-B15C-47CB-84DB-579C248A2DCA.JPG" width="300" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">Under the board is the pretty simple circuit with the oh so important 0.1 uF capacitor that goes between the ATmega reset pin and the FT232RL DTR pin. </span></td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwqarhqLmDSVbtItejbnlfOxaWdGH5h3dQC2AhANEOsRm1mSnEho867nPCvpaYMQMUyMu8ABwWwQW7LiXnn0nJIsOT462eUsp1zgViXk-oTUmxOih9pj11Ew_zyVutLJiVoGHHmveN2HrU/s1600/EA9BFDD7-9E89-4A21-82BD-19C607B85AE5.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="font-family: Arial, Helvetica, sans-serif;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwqarhqLmDSVbtItejbnlfOxaWdGH5h3dQC2AhANEOsRm1mSnEho867nPCvpaYMQMUyMu8ABwWwQW7LiXnn0nJIsOT462eUsp1zgViXk-oTUmxOih9pj11Ew_zyVutLJiVoGHHmveN2HrU/s400/EA9BFDD7-9E89-4A21-82BD-19C607B85AE5.JPG" width="300" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigKoY548vAT3bf6FLpZVK7Vc-tKA2c5mZhUTUBhKnZsoatLjuzF45c8d6dts9j6jHMyoeJKp7mya1v40yo2xLwozy1HPpATV95Wz0QBA5umc7SE9VeaSQPp1GjQWPdh-Vu_7tnGdlXDXCI/s1600/394FD4BC-26F3-4754-9B56-09F0201EF389.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="font-family: Arial, Helvetica, sans-serif;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigKoY548vAT3bf6FLpZVK7Vc-tKA2c5mZhUTUBhKnZsoatLjuzF45c8d6dts9j6jHMyoeJKp7mya1v40yo2xLwozy1HPpATV95Wz0QBA5umc7SE9VeaSQPp1GjQWPdh-Vu_7tnGdlXDXCI/s400/394FD4BC-26F3-4754-9B56-09F0201EF389.JPG" width="300" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">Ready and hooked up to a ATmega328P on a breadboard.</span></td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje98y3I10cnHZ76Q50FWh4epI7_7J9Z7HYY-kVRucN1ZiFXGRlWkegH9GEXhZcfHjNY6gn9EfAHi2Jutqt-6FJVvYNrJZnqmKhf25SDYW8SrS8kRsz1EK9heIHMKjx0nv_4Nt0yezcqX3C/s1600/0850A727-FF54-437B-9CE5-C5E6ABA3185E.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="font-family: Arial, Helvetica, sans-serif;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje98y3I10cnHZ76Q50FWh4epI7_7J9Z7HYY-kVRucN1ZiFXGRlWkegH9GEXhZcfHjNY6gn9EfAHi2Jutqt-6FJVvYNrJZnqmKhf25SDYW8SrS8kRsz1EK9heIHMKjx0nv_4Nt0yezcqX3C/s400/0850A727-FF54-437B-9CE5-C5E6ABA3185E.JPG" width="300" /></span></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;">The Sparkfun FT232RL break out board.</span></td></tr>
</tbody></table>
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-22124266539004375802013-01-21T22:16:00.002+01:002013-03-08T15:47:02.020+01:00Atari Punk Console<div class="separator" style="clear: both;">
So I built an Atari Punk Console. It was... fun! </div>
<div class="separator" style="clear: both;">
<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXWz544gvO0GhBZCjIcVy1RGZ2wr85l-fVeKrEw4bf2_QWlif7pMdRwWkpJqRiVb7pFXRMgen9FEeEMAG3aIz2YEp4wbd_c_iG00c9bfWg4l02Hv0gCb4qmDEYKXAdmFFGYD517zGx0xf2/s1600/6AA47013-B4C9-437E-9FD1-1694C711E76B.JPG"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXWz544gvO0GhBZCjIcVy1RGZ2wr85l-fVeKrEw4bf2_QWlif7pMdRwWkpJqRiVb7pFXRMgen9FEeEMAG3aIz2YEp4wbd_c_iG00c9bfWg4l02Hv0gCb4qmDEYKXAdmFFGYD517zGx0xf2/s400/6AA47013-B4C9-437E-9FD1-1694C711E76B.JPG" /></a><br /></div>
<div class="separator" style="clear: both;">
Finished Atari Punk Console in a Coleman's Mustard Powder can.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmumYnk2c1KlDMur3avbFiIipXRqx7J_4dxVTjLRfmsisD171i4kW-8Re0iBgMzCZlzL6M19Ngg533kXgz3cnZdWwAETRI0uJnmuBbu3qMzqzHDRqIMxUt7WUOEtu44OPqnfJiaUBknDyO/s1600/2792BD6C-BB78-4854-8E3C-FAE4031B4E5A.JPG"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmumYnk2c1KlDMur3avbFiIipXRqx7J_4dxVTjLRfmsisD171i4kW-8Re0iBgMzCZlzL6M19Ngg533kXgz3cnZdWwAETRI0uJnmuBbu3qMzqzHDRqIMxUt7WUOEtu44OPqnfJiaUBknDyO/s1600/2792BD6C-BB78-4854-8E3C-FAE4031B4E5A.JPG" width="300" /></a><br /></div>
<div class="separator" style="clear: both;">
Declaration of contents on the back.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/Oudvjg4OvtA?feature=player_embedded' frameborder='0'></iframe></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
Obligatory video.<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
I based my circuit on these two schematics. Since I only had 555 chips and not a 556 I started with the first schematic but used the 1M Ohm pots from the last one and everything after the 10 uF capacitor. I guess I just liked the sound of the 1 M Ohm pots better. I also added a powerswitch and a LED to indicate ON/OFF.<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcyEjz8pxad6ts4OjM3D-dBBEJz5yM9se1xAODRInLi9T9qES9857iDG41eMqMBDwGook3iaa9xlH9RZVuhZ1gBelluZLHncZsjdwQsWE75GF6qpXDuHywlENAQFe85mlMqJvq0j2r8KNP/s1600/atari_punk01a_862_197.jpg"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcyEjz8pxad6ts4OjM3D-dBBEJz5yM9se1xAODRInLi9T9qES9857iDG41eMqMBDwGook3iaa9xlH9RZVuhZ1gBelluZLHncZsjdwQsWE75GF6qpXDuHywlENAQFe85mlMqJvq0j2r8KNP/s400/atari_punk01a_862_197.jpg" /></a><br /></div>
<div class="separator" style="clear: both;">
Circuit schematic found in <a href="http://www.instructables.com/id/APC-Atari-Punk-Console/">josh1324 Instructable here</a>.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkfw6kiJmLFvlZ0WJULPK8OE2YOUSH_VSEMtbim0QFevfiYblHx9u8nFvGrq_r21uG672bIU-rH28wfo22-x7rbXtQ439FIBF8wEzwdf6uKiUHLD0hDwclKGRvW6px-7uBOAvHhGXr852P/s1600/apc-schem.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkfw6kiJmLFvlZ0WJULPK8OE2YOUSH_VSEMtbim0QFevfiYblHx9u8nFvGrq_r21uG672bIU-rH28wfo22-x7rbXtQ439FIBF8wEzwdf6uKiUHLD0hDwclKGRvW6px-7uBOAvHhGXr852P/s400/apc-schem.png" /></a><br /></div>
<div class="separator" style="clear: both;">
Circuit schematic found in <a href="http://blog.makezine.com/2011/09/13/collins-lab-atari-punk-console/">Collin Cunningham's Make tutorial here</a>.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigFQjBxaSbWEdGezteofCS24xDBWY0Opfo02SRfmqGuMRyr8Uel6tB0Gemc0qIJAkBH5Bp2TUrwHNLl_ohMX7pVJtAUICVQdb9ckoku73psWZpMkx0sEAq_zxbpkrbah8b_FxbjsjyzIpc/s1600/69D8757D-C593-442B-A569-167CCCEB49E8.JPG"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigFQjBxaSbWEdGezteofCS24xDBWY0Opfo02SRfmqGuMRyr8Uel6tB0Gemc0qIJAkBH5Bp2TUrwHNLl_ohMX7pVJtAUICVQdb9ckoku73psWZpMkx0sEAq_zxbpkrbah8b_FxbjsjyzIpc/s400/69D8757D-C593-442B-A569-167CCCEB49E8.JPG" /></a><br /><br />Breadboarded Circuit. This one uses 10K pots as these were the only ones I had lying around.<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQuLKA0wFLMKRN72T4b7h9k1pgXKAVgaN8TlDPNsUjfZRPyaKwi8_qqiTMhJdo6qEuyRhumrfVL2qo6XvQIIWqsgy62vrp_BpzMLvjpvDOTSK6DhHefwrhNEEyTCcL7nzHARNHgh5CWSvl/s1600/F8E71BDE-7176-4E60-A75D-9F65CED43BE0.JPG"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQuLKA0wFLMKRN72T4b7h9k1pgXKAVgaN8TlDPNsUjfZRPyaKwi8_qqiTMhJdo6qEuyRhumrfVL2qo6XvQIIWqsgy62vrp_BpzMLvjpvDOTSK6DhHefwrhNEEyTCcL7nzHARNHgh5CWSvl/s400/F8E71BDE-7176-4E60-A75D-9F65CED43BE0.JPG" /></a><br /><br />Halfway through mounting the circuit on a perfboard ...<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx3rJOV3jdOTRscuS2vJwqGyl9G-3I_9HIkOv_Ed6xBLEq3PyJo-L7OsPi883dYwho8tjIWfPKTvqhkL4ELQWkaKAfPMt_3GDzXAoK362owRUDFlteoJog3rEUrDKltugvu-OBUNe8UEQ9/s1600/2FFEA47E-6AEE-407C-93D3-40A54BA6394B.JPG"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx3rJOV3jdOTRscuS2vJwqGyl9G-3I_9HIkOv_Ed6xBLEq3PyJo-L7OsPi883dYwho8tjIWfPKTvqhkL4ELQWkaKAfPMt_3GDzXAoK362owRUDFlteoJog3rEUrDKltugvu-OBUNe8UEQ9/s400/2FFEA47E-6AEE-407C-93D3-40A54BA6394B.JPG" /></a><br /></div>
<div class="separator" style="clear: both;">
... a low quality perfboard. I had alot of issues with pads coming off, well it could be my soldering technique aswell.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj3vY5Lq1gO0zm1D45BNjAdMUp2NYWEiv6aUJ9rcZuNJR46rNxBdYjdbUtaTOPNGustFBmRro02diexPNvReQ83-849emWy7FFpcnEb7_-UMhRWQ8YV42t2jf-n4TLzM1EsP3EwZsHLOt6/s1600/C7155C2D-FE6F-47FF-AE11-29D6727DFDEA.JPG"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj3vY5Lq1gO0zm1D45BNjAdMUp2NYWEiv6aUJ9rcZuNJR46rNxBdYjdbUtaTOPNGustFBmRro02diexPNvReQ83-849emWy7FFpcnEb7_-UMhRWQ8YV42t2jf-n4TLzM1EsP3EwZsHLOt6/s400/C7155C2D-FE6F-47FF-AE11-29D6727DFDEA.JPG" /></a><br /><br />A green LED indicating power is on and a anarchy symbol indicating punk is on. Pretty basic ;)</div>
<!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-c7Y08XwOoKg%2FUPm8_15uFmI%2FAAAAAAAAhb8%2F1kgkSdXEGqQ%2Fs400%2FC7155C2D-FE6F-47FF-AE11-29D6727DFDEA.JPG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj3vY5Lq1gO0zm1D45BNjAdMUp2NYWEiv6aUJ9rcZuNJR46rNxBdYjdbUtaTOPNGustFBmRro02diexPNvReQ83-849emWy7FFpcnEb7_-UMhRWQ8YV42t2jf-n4TLzM1EsP3EwZsHLOt6/s400/C7155C2D-FE6F-47FF-AE11-29D6727DFDEA.JPG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-MkkuLUvy1W8%2FUPm8_9ezzDI%2FAAAAAAAAhb8%2FHeibdTuYEUc%2Fs400%2F6AA47013-B4C9-437E-9FD1-1694C711E76B.JPG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXWz544gvO0GhBZCjIcVy1RGZ2wr85l-fVeKrEw4bf2_QWlif7pMdRwWkpJqRiVb7pFXRMgen9FEeEMAG3aIz2YEp4wbd_c_iG00c9bfWg4l02Hv0gCb4qmDEYKXAdmFFGYD517zGx0xf2/s400/6AA47013-B4C9-437E-9FD1-1694C711E76B.JPG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-0jmKjZSt7wM%2FUPm8_-tzcEI%2FAAAAAAAAhb8%2F2FrhvjP5X44%2Fs400%2FF8E71BDE-7176-4E60-A75D-9F65CED43BE0.JPG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQuLKA0wFLMKRN72T4b7h9k1pgXKAVgaN8TlDPNsUjfZRPyaKwi8_qqiTMhJdo6qEuyRhumrfVL2qo6XvQIIWqsgy62vrp_BpzMLvjpvDOTSK6DhHefwrhNEEyTCcL7nzHARNHgh5CWSvl/s400/F8E71BDE-7176-4E60-A75D-9F65CED43BE0.JPG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-nKAJYcO_hyo%2FUPm8__G3V-I%2FAAAAAAAAhb8%2FHhgV6NbHpUc%2Fs400%2F2FFEA47E-6AEE-407C-93D3-40A54BA6394B.JPG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx3rJOV3jdOTRscuS2vJwqGyl9G-3I_9HIkOv_Ed6xBLEq3PyJo-L7OsPi883dYwho8tjIWfPKTvqhkL4ELQWkaKAfPMt_3GDzXAoK362owRUDFlteoJog3rEUrDKltugvu-OBUNe8UEQ9/s400/2FFEA47E-6AEE-407C-93D3-40A54BA6394B.JPG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-h09meEa-Ykw%2FUPm-UBFr-zI%2FAAAAAAAAhck%2FXSyl1UGHi-o%2Fs400%2Fatari_punk01a_862_197.jpg&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcyEjz8pxad6ts4OjM3D-dBBEJz5yM9se1xAODRInLi9T9qES9857iDG41eMqMBDwGook3iaa9xlH9RZVuhZ1gBelluZLHncZsjdwQsWE75GF6qpXDuHywlENAQFe85mlMqJvq0j2r8KNP/s400/atari_punk01a_862_197.jpg" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-vA_ANwkt1cI%2FUPm-UMqdhhI%2FAAAAAAAAhcg%2F9NMc25dLkJU%2Fs400%2Fapc-schem.png&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkfw6kiJmLFvlZ0WJULPK8OE2YOUSH_VSEMtbim0QFevfiYblHx9u8nFvGrq_r21uG672bIU-rH28wfo22-x7rbXtQ439FIBF8wEzwdf6uKiUHLD0hDwclKGRvW6px-7uBOAvHhGXr852P/s400/apc-schem.png" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-ePMHVmXUro4%2FUPm8_1XrVuI%2FAAAAAAAAhb8%2FCjIa2pkrQJQ%2Fs400%2F69D8757D-C593-442B-A569-167CCCEB49E8.JPG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigFQjBxaSbWEdGezteofCS24xDBWY0Opfo02SRfmqGuMRyr8Uel6tB0Gemc0qIJAkBH5Bp2TUrwHNLl_ohMX7pVJtAUICVQdb9ckoku73psWZpMkx0sEAq_zxbpkrbah8b_FxbjsjyzIpc/s400/69D8757D-C593-442B-A569-167CCCEB49E8.JPG" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-8FrFfrznJ_8%2FUP6nEwRypXI%2FAAAAAAAAhgY%2F1ULGFjmSsVA%2Fs1600%2F2792BD6C-BB78-4854-8E3C-FAE4031B4E5A.JPG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmumYnk2c1KlDMur3avbFiIipXRqx7J_4dxVTjLRfmsisD171i4kW-8Re0iBgMzCZlzL6M19Ngg533kXgz3cnZdWwAETRI0uJnmuBbu3qMzqzHDRqIMxUt7WUOEtu44OPqnfJiaUBknDyO/s1600/2792BD6C-BB78-4854-8E3C-FAE4031B4E5A.JPG" -->Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-58992442802712848352012-07-07T07:48:00.004+02:002013-03-08T15:47:02.030+01:00A dab of hot glue [UPDATED]<br />
In a rather unsuccessful attempt to interest my two and a half year old in the world of making stuff, I showed her an episode of "<a href="http://sylviashow.com/">Sylvia's super awesome maker show</a>". Instead I learned a <a href="http://www.youtube.com/watch?v=9MH0mw-Lgi0&feature=player_embedded#t=113s">neat trick</a> that will solve an issue I haven't yet experienced... well at least it seems like a very good solution to a problem I might have in the future.<br />
<br />
<b style="background-color: white;">Anyway here it is: </b><span style="background-color: white;">If you solder for instance, battery wires directly onto a perfboard of some sort. Fixate the connection with a dab of hot glue to ensure that the soldered joint doesn't break due to cable movement.</span><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-3NyhTi9fcYw/T_fJ0LJZaII/AAAAAAAAgUg/jFb-GfB12Ww/s1600/IMG_5051.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-3NyhTi9fcYw/T_fJ0LJZaII/AAAAAAAAgUg/jFb-GfB12Ww/s320/IMG_5051.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption">I added some hot glue to my Arduino Standalone Atmega <br />
but I probably should have done this prior to soldering<br />
some of the nearby components. </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-5BfK0P5DHds/T_fJ5-QV52I/AAAAAAAAgUo/SKiW7yt4YNs/s1600/IMG_5052.JPG" imageanchor="1" style="background-color: white; margin-left: auto; margin-right: auto; text-align: center;"><img border="0" src="http://3.bp.blogspot.com/-5BfK0P5DHds/T_fJ5-QV52I/AAAAAAAAgUo/SKiW7yt4YNs/s320/IMG_5052.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption"><br />
It may not look very pretty but it does keep the stress-point <br />
of the cable away from the solder joint. </td></tr>
</tbody></table>
<br />
<br />
By the way <a href="https://twitter.com/make/status/221396864543637505">apparently it's Sylvia's birthday today</a> so congratulations and thank you for the tip!<br />
<br class="Apple-interchange-newline" />
<b>[UPDATE] </b><b><br /></b>With my hot glue gun in one hand and a fistful of desire to fixate cables in the other I managed to destroy a potentiometer. I failed to notice a small hole in the potentiometer near the solder tabs and got glue inside the potentiometer, increasing the inertia quite a bit.<br />
<br />
Heed my warning and be cautious when glueing!Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0tag:blogger.com,1999:blog-917542905889928199.post-9042542965322693502012-07-07T00:05:00.003+02:002013-02-27T09:29:05.299+01:00Arduino: Sending integers over RF with VirtualWireWhen I tried to send the output from a sensor over RF with <a href="http://www.open.com.au/mikem/arduino/">VirtualWire</a> I quickly learned that it wasn't as simple as one two three.<br />
<div>
<br /></div>
<div>
But eventually I got it working with a little help from the good folks at the <a href="http://arduino.cc/forum/index.php/topic,112982.0.html">Arduino forum</a>. </div>
<div>
<br /></div>
<div>
VirtualWire is a library that makes it really easy to transmit using RF modules. I've successfully used two different kinds of 434 Mhz modules with it but it has support for other types aswell. </div>
<div>
<br /></div>
<div>
The code and comments below are pretty much self explanatory:<br />
<br />
Transmitter (<a href="https://www.dropbox.com/s/05yovgc5dhbsunj/VirtualWire_Integer_TX.ino">download source code</a>)<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>/*
Sensor Transmitter
By Markus Ulfberg 2012-07-06
Takes a sensor reading 0-1023
converts it to a char array and sends
to RF receiver unit via VirtualWire
*/
#include <VirtualWire.h>
// LED's
const int ledPin = 13;
// Sensors
const int Sensor1Pin = A2;
// const int Sensor2Pin = 3;
int Sensor1Data;
//int Sensor2Data;
char Sensor1CharMsg[4];
void setup() {
// PinModes
// LED
pinMode(ledPin,OUTPUT);
// Sensor(s)
pinMode(Sensor1Pin,INPUT);
// for debugging
Serial.begin(9600);
// VirtualWire setup
vw_setup(2000); // Bits per sec
}
void loop() {
// Read and store Sensor 1 data
Sensor1Data = analogRead(Sensor1Pin);
// Convert integer data to Char array directly
itoa(Sensor1Data,Sensor1CharMsg,10);
// DEBUG
Serial.print("Sensor1 Integer: ");
Serial.print(Sensor1Data);
Serial.print(" Sensor1 CharMsg: ");
Serial.print(Sensor1CharMsg);
Serial.println(" ");
delay(1000);
// END DEBUG
digitalWrite(13, true); // Turn on a light to show transmitting
vw_send((uint8_t *)Sensor1CharMsg, strlen(Sensor1CharMsg));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13, false); // Turn off a light after transmission
delay(200);
} // END void loop...
</code></pre>
<br />
Receiver <span style="background-color: white;">(</span><a href="https://www.dropbox.com/s/etg5zj411co6u43/VirtualWire_Integer_RX.ino" style="background-color: white;">download source code</a><span style="background-color: white;">)</span></div>
<div>
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>/*
Sensor Receiver
By Markus Ulfberg 2012-07-06
Gets a sensor reading 0-1023 in a char array
from RF Transmitter unit via VirtualWire
converts char array back to integer
*/
#include <VirtualWire.h>
// LED's
int ledPin = 13;
// Sensors
int Sensor1Data;
// RF Transmission container
char Sensor1CharMsg[4];
void setup() {
Serial.begin(9600);
// sets the digital pin as output
pinMode(ledPin, OUTPUT);
// VirtualWire
// Initialise the IO and ISR
// Required for DR3100
vw_set_ptt_inverted(true);
// Bits per sec
vw_setup(2000);
// Start the receiver PLL running
vw_rx_start();
} // END void setup
void loop(){
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
// Non-blocking
if (vw_get_message(buf, &buflen))
{
int i;
// Turn on a light to show received good message
digitalWrite(13, true);
// Message with a good checksum received, dump it.
for (i = 0; i < buflen; i++)
{
// Fill Sensor1CharMsg Char array with corresponding
// chars from buffer.
Sensor1CharMsg[i] = char(buf[i]);
}
// Null terminate the char array
// This needs to be done otherwise problems will occur
// when the incoming messages has less digits than the
// one before.
Sensor1CharMsg[buflen] = '\0';
// Convert Sensor1CharMsg Char array to integer
Sensor1Data = atoi(Sensor1CharMsg);
// DEBUG
Serial.print("Sensor 1: ");
Serial.println(Sensor1Data);
// END DEBUG
// Turn off light to and await next message
digitalWrite(13, false);
}
}
</code></pre>
<br />
<span style="color: #333333; font-family: Georgia, serif; font-size: 13px; line-height: 20px; text-align: left;">Source code formatted for blogger by: </span><a href="http://formatmysourcecode.blogspot.com/" style="color: #999999; font-family: Georgia, serif; font-size: 13px; line-height: 20px; text-align: left; text-decoration: none;">formatmysourcecode.blogspot.com</a>
</div>Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com23tag:blogger.com,1999:blog-917542905889928199.post-54514239797906884822012-06-30T09:14:00.000+02:002013-03-08T15:47:02.028+01:00Arduino standalone ATmegaSoldered up my first standalone ATmega Arduino yesterday.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-GA4vRPzMphY/T-6lo7OZq8I/AAAAAAAAgUE/V91jzXIV3ig/s1600/IMG_5041.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-GA4vRPzMphY/T-6lo7OZq8I/AAAAAAAAgUE/V91jzXIV3ig/s320/IMG_5041.JPG" height="240" width="320" /></a></div>
<br />
It's only running the blink sketch right now but I will soon add a RF transmitter and a sensor...<br />
... and solder up yet another add a RF receiver and some sort of notification.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-uI52riqDIhs/T-6nNPBjobI/AAAAAAAAgUI/eMBw9hMHGKU/s1600/IMG_5040.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-uI52riqDIhs/T-6nNPBjobI/AAAAAAAAgUI/eMBw9hMHGKU/s320/IMG_5040.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="background-color: white;">Same circuit breadboarded </span></td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-EYKG1VKK1sY/T-6lqUKUWiI/AAAAAAAAgT4/lkxtRePEiS4/s1600/IMG_5043.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-EYKG1VKK1sY/T-6lqUKUWiI/AAAAAAAAgT4/lkxtRePEiS4/s320/IMG_5043.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Note to self:</b> Use different color LEDs next time.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-HKC_JY__-yY/T-6lpizuu-I/AAAAAAAAgT0/qjplqZh_hqA/s1600/IMG_5042.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-HKC_JY__-yY/T-6lpizuu-I/AAAAAAAAgT0/qjplqZh_hqA/s320/IMG_5042.JPG" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="https://www.adafruit.com/">Adafruit </a>has a <a href="https://www.adafruit.com/products/554">handy sticker</a> that shows the pinouts of the ATmega. </td></tr>
</tbody></table>
<br />
<br />
<br />
It's based on the tutorials here:<br />
<a href="http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard">http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard</a>
<br />
<a href="http://blog.makezine.com/2009/01/15/cheapest-standalone-arduino/">http://blog.makezine.com/2009/01/15/cheapest-standalone-arduino/</a>
<br />
<br />Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com4tag:blogger.com,1999:blog-917542905889928199.post-55942277810724263702011-12-14T21:44:00.001+01:002011-12-16T22:32:57.078+01:00Arduino Mood Light Controller v3I finally go some time and some inspiration to update the source code of my <a href="http://genericnerd.blogspot.com/2009/05/arduino-mood-light-controller.html">Arduino Mood Light Controller</a>. I'll just try to keep it short ...<br />
<br />
<b>Code cleanup:</b><br />
All the light modes have been moved to separate functions.<br />
Replaced a couple of "If, then..." with "Switch, Case", makes the code somewhat easier to read.<br />
<br />
<b>New features:</b><br />
Added two light modes - cycleColor and lightMyFire.<br />
Speed of pulsateColor and cycleColor now controlled via potentiometer.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/IpDfT_9Eg8w" width="420"></iframe>
<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/hI0D5adZlOc" width="420"></iframe>
<br />
<br />
Download the source code <a href="http://dl.dropbox.com/u/1645571/GenericNerd/ArduinoCode/rgb_mixer_controlled_pulse_makkan_v3_ino.ino">here</a>.<br />
Source code formatted for blogger by: <a href="http://formatmysourcecode.blogspot.com/">formatmysourcecode.blogspot.com</a><br />
<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>/*
RGB LED controller
4 modes: off, color select, color pulse and random cycle/pulse
By Markus Ulfberg 2009-05-19
Updated to Version 2 - 2010-01-13 (Not publicly released)
Updated to Version 3 - 2011-12-14
Thanks to: Ladyada, Tom Igoe and
everyone at the Arduino forum for excellent
tutorials and everyday help.
TODO:
1. Use millis for debounce instead of delay.
*/
// set the ledPins
int ledRed = 10;
int ledGreen = 9;
int ledBlue = 11;
// color selector pin
int potPin = 1;
// lightMode selector
int switchPin = 2;
// light mode variable
// initial value 0 = off
int lightMode = 0;
// LED Power variables
byte redPwr = 0;
byte greenPwr = 0;
byte bluePwr = 0;
// Variables for lightMode 2
// variables for keeping pulse color
byte redPulse;
byte greenPulse;
byte bluePulse;
int pulseSpeed;
// Set pulse to down initially
byte pulse = 0;
// floating variables needed to be able to pulse a fixed color
float redFloat;
float greenFloat;
float blueFloat;
// the amount R,G & B should step up/down to display an fixed color
float redKoff;
float greenKoff;
float blueKoff;
// Variables for lightMode 3
// set the initial random colors
byte redNew = random(255);
byte greenNew = random(255);
byte blueNew = random(255);
// Variables for cycleColor
int truColor = 0;
// misc interface variables
// potVal store the value of the potentiometer for various needs
int potVal;
// value from the button (debounce)
int switchVal;
int switchVal2;
// buttonState registers if the button has changed
int buttonState;
void setup()
{
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledBlue, OUTPUT);
pinMode(potPin, INPUT);
pinMode(switchPin, INPUT);
buttonState = digitalRead(switchPin);
// serial for debugging purposes only
Serial.begin(9600);
}
void loop()
{
switchVal = digitalRead(switchPin); // read input value and store it in val
delay(10); // 10 milliseconds is a good amount of time
switchVal2 = digitalRead(switchPin); // read the input again to check for bounces
if (switchVal == switchVal2) { // make sure we got 2 consistant readings!
if (switchVal != buttonState) { // the button state has changed!
if (switchVal == LOW) { // check if the button is pressed
switch (lightMode) { // light is off
case 0:
lightMode = 1; // light is on and responds to pot
break;
case 1:
lightMode = 2; // light pulsates in the latest color from pot
break;
case 2:
lightMode = 3; // light cycles thru colors
break;
case 3:
lightMode = 4; // light changes randomly
break;
case 4:
lightMode = 5; // simulated fire
break;
case 5:
lightMode = 0; // light is off
break;
} // END switch (lightMode)
} // END if (switchVal == LOW)
} // END if (switchVal != buttonState)
buttonState = switchVal; // save the new state in our variable
} // END if (switchVal == switchVal2)
/*
// Debug
Serial.print("lightMode: ");
Serial.println(lightMode);
*/
switch (lightMode) {
case 0:
lightsOff();
break;
case 1:
colorControl();
break;
case 2:
pulsateColor();
break;
case 3:
cycleColor();
break;
case 4:
randomColor();
break;
case 5:
lightMyFire();
break;
}
} // END loop()
// lightMode 0
void lightsOff() {
redPwr = 0;
greenPwr = 0;
bluePwr = 0;
colorDisplay();
}
// lightMode 1
void colorControl() {
// read the potentiometer position
potVal = analogRead(potPin);
// RED > ORANGE > YELLOW
if (potVal > 0 && potVal < 170) {
redPwr = 255;
bluePwr = 0;
greenPwr = map(potVal, 0, 170, 0, 255);
}
// YELLOW > LIME?? > GREEN
if (potVal > 170 && potVal < 341) {
greenPwr = 255;
bluePwr = 0;
redPwr = map(potVal, 341, 170, 0, 255);
}
// GREEN > TURQOUISE
if (potVal > 341 && potVal < 511) {
greenPwr = 255;
redPwr = 0;
bluePwr = map(potVal, 341, 511, 0, 255);
}
// TURQOUISE > BLUE
if (potVal > 511 && potVal < 682) {
bluePwr = 255;
redPwr = 0;
greenPwr = map(potVal, 682, 511, 0, 255);
}
// BLUE > PURPLE
if (potVal > 682 && potVal < 852) {
bluePwr = 255;
greenPwr = 0;
redPwr = map(potVal, 682, 852, 0, 255);
}
// PURPLE > RED
if (potVal > 852 && potVal < 1023) {
redPwr = 255;
greenPwr = 0;
bluePwr = map(potVal, 1023, 852, 0, 255);
}
redFloat = float(redPwr);
greenFloat = float(greenPwr);
blueFloat = float(bluePwr);
redKoff = redFloat / 255;
greenKoff = greenFloat / 255;
blueKoff = blueFloat / 255;
redPulse = redPwr;
greenPulse = greenPwr;
bluePulse = bluePwr;
/*
// Debug
Serial.print("redFLoat: ");
Serial.print(redFloat, DEC);
Serial.print(" redPwr: ");
Serial.print(redPwr, DEC);
Serial.print(" greenFloat: ");
Serial.print(greenFloat, DEC);
Serial.print(" greenPwr: ");
Serial.print(greenPwr, DEC);
Serial.print(" blueFloat: ");
Serial.print(blueFloat, DEC);
Serial.print(" bluePwr: ");
Serial.println(bluePwr, DEC);
// End debug
*/
// Display colors
colorDisplay();
}
// lightMode 2
void pulsateColor() {
// get colors from colorControl
redPwr = int(redFloat);
greenPwr = int(greenFloat);
bluePwr = int(blueFloat);
// Read speed from potentiometer
pulseSpeed = analogRead(potPin);
pulseSpeed = map(pulseSpeed, 0, 1023, 0, 255);
//display the colors
colorDisplay();
// set speed of change
delay(pulseSpeed);
// pulse down
if (pulse == 0) {
if (redFloat > 10) {
redFloat = redFloat - redKoff;
}
if (greenFloat > 10) {
greenFloat = greenFloat - greenKoff;
}
if (blueFloat > 10) {
blueFloat = blueFloat - blueKoff;
}
// If all xFloat match 10 get pulse up
if (byte(redFloat) <= 10) {
if (byte(greenFloat) <= 10) {
if (byte(blueFloat) <= 10) {
pulse = 1;
}
}
}
}
// Pulse up
if (pulse == 1) {
if (redFloat < redPulse) {
redFloat = redFloat + redKoff;
}
if (greenFloat < greenPulse) {
greenFloat = greenFloat + greenKoff;
}
if (blueFloat < bluePulse) {
blueFloat = blueFloat + blueKoff;
}
// If all Pwr match Pulse get pulse down
if (byte(redFloat) == redPulse) {
if (byte(greenFloat) == greenPulse) {
if (byte(blueFloat) == bluePulse) {
pulse = 0;
}
}
}
}
/*
// Debug
Serial.print("redFloat: ");
Serial.print(redFloat, DEC);
Serial.print(" redPulse: ");
Serial.print(redPulse, DEC);
Serial.print(" greenFloat: ");
Serial.print(greenFloat, DEC);
Serial.print(" greenPulse: ");
Serial.print(greenPulse, DEC);
Serial.print(" blueFloat: ");
Serial.print(blueFloat, DEC);
Serial.print(" bluePulse: ");
Serial.print(bluePulse, DEC);
Serial.print(" pulse: ");
Serial.println(pulse, DEC);
// End debug
*/
} // pulsateColor END
// lightMode 3
void cycleColor() { // Cycles through colors
switch(truColor) {
// RED > ORANGE > YELLOW
case 0:
redPwr = 255;
bluePwr = 0;
greenPwr++;
if (greenPwr > 254) {
truColor = 1;
}
break;
// YELLOW > LIME?? > GREEN
case 1:
greenPwr = 255;
bluePwr = 0;
redPwr--;
if (redPwr < 1) {
truColor = 2;
}
break;
// GREEN > TURQOUISE
case 2:
greenPwr = 255;
bluePwr++;
redPwr = 0;
if (bluePwr > 254) {
truColor = 3;
}
break;
// TURQOUISE > BLUE
case 3:
greenPwr--;
bluePwr = 255;
redPwr = 0;
if (greenPwr < 1) {
truColor = 4;
}
break;
// BLUE > PURPLE
case 4:
greenPwr = 0;
bluePwr = 255;
redPwr++;
if (redPwr > 254) {
truColor = 5;
}
break;
// PURPLE > RED
case 5:
greenPwr = 0;
bluePwr--;
redPwr = 255;
if (bluePwr < 1) {
truColor = 0;
}
break;
}
// START SPEED
pulseSpeed = analogRead(potPin);
pulseSpeed = map(pulseSpeed, 0, 1023, 0, 255);
//display the colors
colorDisplay();
// set speed of change
delay(pulseSpeed);
// END SPEED
} // END cycleColor
// lightMode 4
void randomColor() { // randomize colorNew and step colorPwr to it
if (redPwr > redNew) {
redPwr--;
}
if (redPwr < redNew) {
redPwr++;
}
if (greenPwr > greenNew) {
greenPwr--;
}
if (greenPwr < greenNew) {
greenPwr++;
}
if (bluePwr > blueNew) {
bluePwr--;
}
if (bluePwr < blueNew) {
bluePwr++;
}
// If all Pwr match New get new colors
if (redPwr == redNew) {
if (greenPwr == greenNew) {
if (bluePwr == blueNew) {
redNew = random(254);
greenNew = random(254);
blueNew = random(254);
}
}
}
// display the colors
colorDisplay();
// Set speed of change
delay(20);
} // END randomColor
// lightMode 5
void lightMyFire() {
// Flicker will determine how often a fast flare will occur
int flicker;
// set flicker randomness
flicker = random(800);
// Set random colors,
// constrain green to red and blue to green
// in order to stay within a red, blue, white spectrum
redPwr = random(220, 240);
greenPwr = random(180, 200);
// when flicker occur, the colors shine brighter
// adding blue creates a white shine
if (flicker > 750) {
redPwr = 254;
greenPwr = random(200, 230);
bluePwr = random(0, 50);
} else {
bluePwr = 0;
}
// display Colors
colorDisplay();
// Set speed of fire
delay(20);
} // END lightMyFire
// Displays the colors when called from other functions
void colorDisplay() {
analogWrite(ledRed, redPwr);
analogWrite(ledGreen, greenPwr);
analogWrite(ledBlue, bluePwr);
}
</code></pre>Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com2tag:blogger.com,1999:blog-917542905889928199.post-73528985820461022552011-10-27T06:45:00.000+02:002013-02-27T09:44:02.962+01:00How I fixed a rattling laptop fanSo my laptop fan started rattling recently. First I thought it might be my hard drive that was about to give up, so I was kind of glad it was "just" the fan. Until the noise of the fan started to drive me slightly insane. My first attempt of silencing the fan was a failure. I opened up my laptop and cleaned out all the dust in the fan and the vents. I also checked if there any loose pieces of something in the fan, but didn't find anything. After putting the laptop back together again it didn't take long for the fan to start making noise again.<br />
<br />
So yesterday evening I opened up my laptop again, about a month after my initial try. I took it one step further this time, I removed the fan completely and disassembled it up til the point where I had the fan blades removed from the housing. After cleaning everything as good as possible I put a drop of oil (for sewing machines) on the spindle where the fan blades sit. When I had put everything back togheter I could verify that my laptop now indeed was quiet as a mouse. And yes before you ask, the fan i still working.<br />
<br />
Unfortunately I didn't take any pictures of this but hopefully it's quite easy to understand anyway. If you don't please just ask and I will try to give you an answer.Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com3tag:blogger.com,1999:blog-917542905889928199.post-41476833210097992692010-09-08T10:00:00.000+02:002010-09-08T10:00:35.610+02:00HiatusIt's been a while since my last post. The reason is quite simple I've had my focus somewhere else. Late december 2009 my wife gave birth to our daughter and since then I've spent most of my free time with my two girls.<br />
<br />
Anyway I'm still alive and both new and old projects are in the pipeline, however as of now there's simply not enough time to get things flowing again.Generic Nerdhttp://www.blogger.com/profile/06634230781516609525noreply@blogger.com0