Wednesday, November 10, 2010

mount ISO files instead of burning them to a disk

I wanted to install a piece of software on my computer that I downloaded from the internet as an ISO image. I knew those are files that one usually burns onto a CD and then installs from there; I have done my fair share of linux installs like that.

But what if I don't want to burn the file onto a CD? Surely there are ways of making the file usable without wasting a CD or DVD.

And of course there are:
Virtual CloneDrive works and behaves just like a physical CD/DVD drive, however it exists only virtually. Image files generated with CloneDVD or CloneCD can be mounted onto a virtual drive from your hard-disk or from a network drive and used in the same manner as inserting them into a normal CD/DVD drive.


great! What I needed and you can find it here: http://www.slysoft.com/en/virtual-clonedrive.html

Tuesday, November 2, 2010

Playing an mp3 file with the VS1053 arduino shield

Here's the code that plays a "hello" on speakers connected to the mp3 shield for the arduino made by sparkfun:

download the pde file from here.

This code is a port of a code made available by VLSI (the manufacturers of the VS1053 mp3 chip), available on their forum for the AT89C51ED2/RD2 microcontroller.
Have fun. Still working on getting the shield working with a VLC stream, slow but getting there and this port is part of way to get there!
Cheers,
Rui
PS: note that the Tx and Rx pins must be pulled out of the mp3 shield so that they do not connect with the arduino board.

Saturday, September 25, 2010

Ethernet Shield SPI mod

Some people have been working on a modification to allow them to use the official arduino ethernet shield with the provided yet unsupported SD card reader (there seems to be major updates to the shield: as I write these lines the NYC maker faire is on and the arduino team is announcing some major changes to the arduino family including, I hear, a new ethernet shield...).

I will modify my ethernet shield to allow me to use it stacked with the VS1053 chip mp3 decoder shield and not have them both fight for SPI communications (this would happen because the Wiznet chip that comes on the ethernet shield, does not implement a proper version of SPI and it is recommended to disable SPI on the chip altogether when not in use - basically it disabling the SS line doesn't actually stop the chip from sending information to the SPI bus, confusing all the other SPI devices that happen to be connected to the bus).

So the steps I will follow are:

1. add a wire between the SEN pin of the wiznet chip and one of the ATmega ports on the arduino (I choose D8).
2. modify the ethernet library to change the state of the extra pin every time we finish a SPI read/ write cycle.

I will keep posting as I go...

new sine test wave for VS1053 shield on an arduino board

UPDATE 06.05.2011: if the code below, doesn't work for you, try SPI_MODE1 instead of SPI_MODE0 (thanks Anonymous).

This new code for the arduino + mp3 shield sine wave tester works much better than the one I posted on my last post. Basically I removed the infinite for loop on the main loop() function and added a 1ms delay after setting the CS line LOW or HIGH. I got this last tip here.

This code works on the 0019 arduino IDE and uses the new SPI library that comes with the IDE.

code:
 #include [SPI.h] //replace [] by greater than and smaller than symbols - had to do this because of
//the blog stripping the symbols because it thinks it's html
int CS_pin = 9;
int DREQ_pin = 3;
void setup() {
  pinMode(CS_pin, OUTPUT);
  pinMode(DREQ_pin, INPUT);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  //CPOL = 0, CPHA = 1
  //see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_Numbers
  //and decoder chip datasheet
  SPI.setDataMode(SPI_MODE1);
  //max SDI clock freq = CLKI/7 and (datasheet) CLKI = 36.864, hence max clock = 5MHz
  //SPI clock arduino = 16MHz. 16/ 4 = 4MHz -- ok!
  SPI.setClockDivider(SPI_CLOCK_DIV4);
  initialize();
}
void loop(){
  digitalWrite(CS_pin, HIGH);
  chip_write(0x00, 0x0c20); // sets sci_mode register, SM_SDINEW, SM_SDISHARE
                          // SM_TESTS.  pg 25, 26
  chip_sineTest(0xAA);   // test tone frequency (pg 35)
}
void chip_write (unsigned int address, word data){
    byte aux;
    digitalWrite(CS_pin, LOW);
    delay(1);
    SPI.transfer(0x02);  //write command
    SPI.transfer(address); //SDI_MODE register
    //extract and send higher byte of data
    aux = data >> 8;
    SPI.transfer(aux);
    //extract and send lower byte of data
    aux = data & 0b11111111;
    SPI.transfer(aux);
    //wait for the chip to finish executing command
    //while (!digitalRead(DREQ_pin)){};
    digitalWrite(CS_pin, HIGH);
    delay(1);
}
void chip_sineTest(int pitch){
   digitalWrite(CS_pin, HIGH);
   delay(1);
   SPI.transfer(0x53);
   SPI.transfer(0xEF);
   SPI.transfer(0x6E);
   SPI.transfer(pitch);
   SPI.transfer(0);
   SPI.transfer(0);
   SPI.transfer(0);
   SPI.transfer(0);
   digitalWrite(CS_pin, LOW);
   delay(1);  
}
void initialize(){


}

Tuesday, September 21, 2010

Arduino and SparkFun MP3 shield test code

For the speakers project I'm currently working in, I got an mp3 shield for the arduino from sparkfun. I'm currently exploring the VS1053D decoder chip. To that goal, I wrote the attached testing code that will put the chip to test mode and output a sine wave sound with adjustable pitch. I noticed that there's not much info available on the internet to make this shield work, so I'll make make code available as I go (check also the google code pages for this project.

#include SPI.h ---> put brackets here and delete this comment
int CS_pin = 9;
int DREQ_pin = 3;
byte received;
void setup() {
  pinMode(CS_pin, OUTPUT);
  pinMode(DREQ_pin, INPUT);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  //CPOL = 0, CPHA = 1 
  //see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_Numbers
  //and decoder chip datasheet
  SPI.setDataMode(SPI_MODE1);
  //max SDI clock freq = CLKI/7 and (datasheet) CLKI = 36.864, hence max clock = 5MHz
  //SPI clock arduino = 16MHz. 16/ 4 = 4MHz -- ok!
  SPI.setClockDivider(SPI_CLOCK_DIV4);
  initialize();
}


void loop(){
  digitalWrite(CS_pin, HIGH);
  chip_write(0x00, 0x0c20); // sets sci_mode register, SM_SDINEW, SM_SDISHARE
                          // SM_TESTS.  pg 25, 26
  chip_sineTest(0xAA);   // test tone frequency (pg 35)
  
  for (;;){}
}
void chip_write (unsigned int address, word data){
    byte aux;
    digitalWrite(CS_pin, LOW);
    SPI.transfer(0x02);  //write command
    SPI.transfer(address); //SDI_MODE register
    //extract and send higher byte of data
    aux = data >> 8;
    SPI.transfer(aux);
    //extract and send lower byte of data
    aux = data & 0b11111111;
    SPI.transfer(aux);
    //wait for the chip to finish executing command
    while (!DREQ_pin){};
    digitalWrite(CS_pin, HIGH);
}
void chip_sineTest(int pitch){
   digitalWrite(CS_pin, HIGH);
   SPI.transfer(0x53);
   SPI.transfer(0xEF);
   SPI.transfer(0x6E);
   SPI.transfer(pitch);
   SPI.transfer(0);
   SPI.transfer(0);
   SPI.transfer(0);
   SPI.transfer(0);    
}
void initialize(){
   
}

Thursday, August 5, 2010

Weather Station Project

And the weather station is finally generating charts and sending them to the web for all to see. Check the charts updated every hour here.

I will upload the final code to the project page on google code and there's quite a lot to do (for which I would love to get contributors):

- wind direction chart is really not readable and needs to be redone.
- code needs to be cleaned.
- bugs need to be reported and solved.
- rain code on the arduino is not good enough and we don't get a lot of the triggers resulting in 0 rain when it's actually raining.

Saturday, July 31, 2010

Started development of the Wifi Speaker Project PC Client Application

Now that the server part of the software is practically complete with streaming capabilities working, it's time to take a look at what is going on with the client side (i.e. the speaker side).

The ultimate goal of this project is to develop not only the SW but also the HW on the client side, including amplifier, decoder, wifi receiver. I already have some ideas of how i'm going to do that on the HW side, but I thought it's probably a better idea to start with a client PC application that behaves much like the future HW on the speakers without having to force me to go ahead just yet on the HW side.

I have just uploaded to the google repository of the project the first mock-up of the GUI for the client side. Actually there's really no GUI, just a debugging form where I can see all the messages sent by the client, the messages received and the stream decoder messages.\

Take a look at the upcoming client SW here and stay tuned as I expect to have it ready until the end of this week.

Monday, July 26, 2010

Weather Station - pics and software

As mentioned the other day on my last weather station blog entry, here's some pics of my weather station installation:

The weather station sensors at the top of my roof: wind vane, anemometer and rain gauge. LCD placed inside the house reporting current weather (temperature, relative humidity, wind direction, wind speed and precipitation (yeah it does get that hot and humid around here and that's actually quite low humidity for July...)

 
Just a detail of the mounting of the weather station with a bit of rust on it which is quite surprising considering that it has been up for only 2 months. The arduino box and, just below, the temperature and humidity sensor box. The shade from the upper, larger box shields the sensor from the sun (this is not entirely successful but it works most of the time...

The inside of the box. The sensors come to the box that houses, power, the arduino and the arduino ethernet shield. Everything is housed on an IP65 box with a bit of silicone to provide extra water protection.

Regarding the software, visit my pages on code.google.com, it's still undocumented and simply a software repository but if you have patience you can make it work! A word of caution about the PHP software as it still is not completely ready.

Next steps on this project are:

- Finish the PHP code
- Implement the crontab scheduled database save of data and chart image upload to server
- Show real-time weather data from my station on this page
- Clean up the code (it's a bit chaotic now)
- Document the project
- Get help to improve the code

Saturday, July 24, 2010

Network Sniffer

Today for work I had the need to use a network sniffer to check packets on our control network (quite critical since it involves moving people around). I quickly search the internet for something light that could be run from a flash drive since one of the requirements we have is no installations on the production machines.

So I came across the very light but quite powerful smsniffer. It's just a simple executable that runs from wherever it is located (on a flash drive for example).

Recommended if you need something like this.

Thursday, July 22, 2010

Accuser

A while ago I talk to my friend Konstantin about working on one of his sculptures called "the accuser". The accuser is a man sitting on a chair with one arm up pointing towards the observer.


The task was to automate the pointing arm so that it would move upon detection of an observer.

Below is a section of the instruction manual I prepared when I delivered the automated arm:
The accuser arm is a robotic arm with two DOF (shoulder and elbow) that moves between two positions (arm down and arm raised) triggered by the readings of an ultrasonic sensor. The following parameters are adjustable (see point 3 for instructions on how to adjust the values):

  • Independent setting of rest position for each motor

  • Independent setting of raised position for each motor

  • Distance at which the movement is triggered

  • Amount of time the arm is raised

  • Amount of time the arm waits to be activated again after returning from a raised position (avoids repeated activations)

  • Speed at which the assembly moves

  • If arm is raised randomly or not upon detection of a person (useful to accuse only some people).

  • The likelihood of raising the arm if the option to raise the arm randomly is selected (e.g. 25% of the detections, 33% of detections, etc).
I installed 2 high torque/ high speed futaba servos, controlled by an arduino board which in turn is connected to an ultrasonic sensor. I made simple arm with two pieces of aluminium (see the attached document) with a servo on each joint. The movement is quite realistic!

The project is described in more detailed on the users manual (including program configuration and arduino interface to the Ultrasonic Range Finder - XL-Maxsonar EZ0 and the arduino programming file is also below:


HP Pavilion DV2

One of the best things I did on my recent life (ok, maybe I'm exaggerating...) was to buy a HP pavilion dv2 laptop computer. This is the computer I use for everything that I do and I do a lot with computers. I carry it everywhere I go, sometimes without the luxury of a bag and it works like a charm.


I run a dual boot system with ubuntu linux (not a partition install but a file install with wubi, more about that later on another post because I think that experience is cool and I wat to share) and windows 7 ( a great operating system IMHO).

HP pavilion DV2 good stuff:

1. Low price
2. Small but not so small you need a magnifying glass
3. Works great with ubuntu 9.1 (maybe even better with the latest version)
4. Very light
5. Fast Processor (at least for anything I need - no crazy 3D gaming though)
6. Cool looks
7. Comes with external DVD burner (I seldom use it, so why do I need to carry it everywhere? but I still want to have one, so this is the very best option!)
8. HDMI port
9. Absolutely great keyboard in terms of size and feel

HP pavilion DV2 not so good stuff:

1. Construction and material feels a bit weak and low quality
2. VERY LOW battery life (2.5 hours)
3. Mousepad is very usable but not to my liking (I use an external USB mouse anytime I can)

My very old Robosapiens Robot dissection


Ever since I can remember I would buy all the toy robots I could find and pay for. More often then not they wouldn't last long because I would open them up and see what was inside.

About 8 years ago I published a rather famous post in the amateur robotics community about the internals of the the then very popular robosapiens robot from wowwee (now a quite famous toy robot company).


I think I bought it the day it came out and I was one of the first that took pictures of the internals and documented them. I have lost the post a long time ago but I recently found this link to the article and it made me think about. I still have the robot. It's my daughter's toy and it still works!

Wifi Speaker Project


Today I release the first semi-working v0.0 ALPHA ALPHA ALPHA version of the server software for the wifi speakers project. It's developed in DELPHI, runs on windows and I publish the binaries only although this is obviously an open source application [EDIT: source is now available also]. Here's a screenshot:


limitaions of this version:

- only streams in HTTP
- cannot manage spakers yet, so it multicasts everything
- play locally button doesn't work
- find speakers doesn't work
- managing groups button doesn't work yet
- mic vol adjustment button doesn't work yet

---- You need to install VLC 1.1 to run this application. Then on a remote computer, use VLC1.1 again and open a network stream with URL: http://IP_shown_in_server_app(local_IP):8080. You should hear the stream of your line in or the file that you decided to stream out.

Of course this is only the start, but I think that having managed to stream stuff out is the hardest step. The rest is fairly simple (well, except for the client side but that's another story).

Thanks Gerald to point me to VLC. As always, good call!

Download application and source from the project page on code.google.com (dont' forget you need VLC1.1). Remeber this is the very basic release, I will spend the rest of this week making everything else work.

Wednesday, July 21, 2010

Weather Station Project

A while ago I bought the weather station sensors from sparkfun electronics. I installed them on my roof the other day and connected everything to an arduino microcontroller board which in turn is connected to a wired ethernet shield, all bought on sparkfun. I also got the humidity and temperature sensor SHT15 breakout board. I had an Hitachi-compatible LCD laying around that I connected to the arduino and installed on a box inside my house, giving me instant data information.

The weather information I can collect is:

Temperature (SHT15)
Relative Humidity (SHT15)
Wind Direction (weather sensor assembly)Wind Speed (weather sensor assembly)
Precipitation (weather sensor assembly)

I put everything on a IP65 box that I installed outside on the wall up close to the roof and brought cables in to my house (power, data for LCD and ethernet). I hope that I can take some pictures of the hardware someday and post them here.

The ethernet shield reports all the available data upon request from a client computer. I have until now developed all the code on the arduino including:

Interface with weather sensors (Wind speed, direction, rain gauge)
Interface to the SHT15 Temperature and Humidity Meter
Interface with the Ethernet shield and transfer of data through http
Interface with the LCD screen

This is the complete wiring connections that I did (excluding LCD):


I know the schematics are kind of terrible but they are good for guidelines in case you would like to do something like this. I've got larger versions, email me in case you need them.

In my next post, I will upload the arduino code that makes all of this possible. After that I will post the PHP code I wrote to update a mySQL database with weather data so that I can see the history and, for example, see the evolution of relative humidity throughout the year.

Sunday, July 18, 2010

Save your Internet Explorer Session

I always wanted to do like I can easily do with firefox and save the session I currently have open on my browser. That means saving all the tabs and reopen them next time I feel like.

I solved that problem just now: On internet explorer, close the window and next time you open and would like to go back to the previous session, simply do 'tools' -> 'Reopen Last Browsing Session' and, guess what? It does just that!!

What about if you don't want to open your last session? but still want to save it?hum... still working on that one!

Cheers

Saturday, January 23, 2010

GRASP 3 hardware setup


I will be using a mekatronix robotic arm. For the original GRASP I made my own frame and attached the servos to it. That was because I had a lot of time but now I have less time and more money so I bought the assembly from mekatronix (actually I bought it a few years ago and never got to use it).

The servos are standard hobby servos made by hitec (specs of the ones I'm using here).

So first thing's first: mount all the hardware.
See picture of the assembly above. It's simply a mekatronix mindstamp base and a robotic arm on top with 3 degrees-of-freedom, gripper, wrist and elbow. I screwed the arduino board in the back and a small breadboard to use as interface between the arduino and the servos. I thought I was going to oonly do that since I still have to go into the arduino language but I noticed that a) it's very similar to C which I have some experience with and it has a lot of libraries prewritten to take the complexity out of programming it. So I went to the examples just playing around and I noticed the servo sweep example. A miracle! It turns out that the arduino environment has very good libraries there begging to be used that deal with servo position control. So I opened it, qickly edited it to go from 1 servo in the example to 3 servos and you can see the video:



Next step is dwell into the processing language and get the servos moving through position commands sent from the PC. Wish me luck.

Project 1 - Internet controlled Robot Arm GRASP 3

a few years ago, I did a robotic arm that could be controlled over the internet using a PIC16F84 processor. the setup was simply an arrangement of servos built using disposed items (aka garbage) such as a CD case rotating base and ice cream sticks as the frame. At the time, I installed a camera pointed at the robot and users could login to my linux computer and control the arm while receiving position feedback through the camera.


That was a long time ago (4 years maybe). I remember a few details like the software which I miraculously managed to save (I think I still have the servo controller program that goes into the pic16f84 processor), apache and php on linux and camserv as the camera server. It worked pretty well and I had a lot of questions and people interested to know how I did it.

I called the robotic arm GRASP 2 and posted a short descrition that still lives on the net here in the famous robomenu (is it still famous?).


I dug out the hardware from a box I used to keep all my junk and here are some pics of how it looks now:

Sorry, you have to tilt your head to the left.

I did a lot of other projects involving the internet and robot (or remote motor control is more accurate) control. I obviously had a lot of free time on my hands. Those were times of a lot of tinkering and autopsies to dead electronics equipment (I did an autopsy to the first version of the robosapiens robot just hours after it came out, it was quite a hit in the robotics community - BTW I was surprised to see how well Wowwee - the makers of the robosapiens robots have been doing with a lot of new robot oys in the market - good for them). I remember that I even bought dead devices such as printers to scavenge the internals for parts, a bit like a vulture, except that vultures don't pay for food.

Then I stopped because my interests changed a bit but the bug of robotics/ electronics has stayed with me. And also one gets older, has a family and the rooms are just not big enough anymore.

But as it turns out, I recently landed a rather technical job that woke up all my dorment electronic neurons and I slowly started to get back to it. Currently I'm rebuilding my lab and I'm getting up to date with what the robotics and control world is doing at the moment (I used to program a lot the now 30-year-old motorola 68HC11 which still seems quite powerful to be honest, but one needs to update...)

I decided to check what all the fuss is about with the arduino controller board based on the Atmega328, so I went out and got one. Easy first step. It looks cool. Because of the arduino I just discovered the processing language and I'm very interested to learn it. I come from a C background and the processing language (I really never had heard about it before...) seems to be similar.

So, lets see: controller, check. PC programming language, check. USB camera, check. Old GRASP assembly, check, new mekatronix robotic arm begging for people to play with it over the internet, check. you see where this is going, right?

GRASP 3, version 2010 is on it's way and I hope I will be disciplined enough to document my steps as I go from nothing to a internet controlled robotic arm with position feedback through a camera.

I may also add some other projects I work on (because my head never stops and is always thinking about what I will do next. It is my style to also talk about sites that are interesting to me so expect that as well). You are more then welcome to share your views with me at any time, and that is why I will switch the user comments off (you can still email me).

May the force be with me.