Mac OS X - jDownloader reconnect (TG787)
Submitted by admin on Sun, 30/05/2010 - 20:16
Recently I started using this fantastic Java-based program that allows me to download things easily from Rapidshare and a-like services.
These are some things I didn't like about these sites:
- the ammount of time needed to wait before starting downloads
- that time increases as you download more files
- the download limit per user a day
- the size limit, that leads to file *parts (sometimes I had to download 40+ files)
- one download at a time
Well, there are some tricks to bypass some of these limitations, for example, the second one, if you renew your IP address you can save time, because the waiting time will be shorter.
Then I found jDownloader, that can save a list of links and can be configured to run a script after each download. The script is used to restart the Internet connection of the router.
Note: This only works if your ISP supports dynamic IP.
Of course, this differs if your router is not Thomson TG787, but it is likely to work on most Thomsons that allow Telnet access.
Here it is:
- #!/bin/bash
- (
- sleep 1
- echo -e "*USERNAME*\r"
- sleep 1
- echo -e "*PASSWORD*\r"
- sleep 1
- echo -e "ppp ifdetach intf=Internet\r"
- sleep 2
- echo -e "ppp ifattach intf=Internet\r"
- sleep 2
- echo -e "exit\r"
- ) | telnet 192.168.1.254 | tee /dev/null 2>&1
You just have to replace *USERNAME* and *PASSWORD* with your own credentials. That user must have privileges to run those commands.
You save this in a file, give it a name, and remember its path... Lets say we save it as "restart.sh" in the folder "/Users/ricardo/"
Now, its time to test our script.
Firstly, go to http://www.whatismyip.com/ and take a look at your IP address.
Then, open a Terminal window and run that command...
- cd /Users/ricardo/
- ./restart.sh
Make sure it is working and that your IP has changed by refreshing the webpage I gave you in the first step.
If it is working, then we only need to tell jDownloader where this script is:
- Open jDownloader
- Go to Settings > Modules > Reconnection
- Chose "External" and then give the full path to your script. In this case, just write
/Users/ricardo/restart.sh
Test it, by clicking the Change IP button and see it working!
I hope this will help someone. ;)
Serial Communication in Mac OS X
Submitted by admin on Tue, 04/05/2010 - 22:24
The year I moved to Univerity, I decided to give UNIX a try. My first approach to a UNIX Operating System was Ubuntu.
It was cool, easy to use, and I really liked it. The migration to a new OS is never easy... And it was not! There are many differences, but as long as you have Google to search, you find your way easily.
I needed a notebook and I had a chance to buy a MacBook. I couldn't be happier!
Some days after, I needed a way to receive the Serial data from Arduino into the Terminal.
Of course, Google helped and here is the answer for future reference:
First, open Terminal (Applications/Utilities/Terminal).
Now you need to find the Arduino's serial port. To get a list of your serial ports, type
ls /dev/tty.*
Then, pick the one that contains "/dev/tty.usbserial"
Let's take this as an example: "/dev/tty.usbserialABC123"
To start serial communication with the port (at 9600 baud-rate), simply run this command:
screen /dev/tty.usbserialABC123 9600
To quit, type control-A, then control-\.
I hope this will help someone...
Bluetooth Servos
Submitted by admin on Wed, 07/04/2010 - 10:28Hello everyone.
I'd like to share with you my latest mini-project.
I wanted to control a Pan&Tilt system from my mobile phone.
Note: the audio is in Portuguese, but I took some time to make the English subtitles.
Using:
2 Servos (Pan & Tilt)
1 Arduino Duemilanove
1 Processing Application (running in the computer)
1 Mobile Processing Application (running in the mobile phone)
Code
To see the code, click the "Read More" below.
FNR 2010
Submitted by admin on Tue, 30/03/2010 - 12:32Content Translation
Submitted by admin on Mon, 15/03/2010 - 02:11
Little by little, the content is being translated to English.
There is still a project to be translated. After that, I will translate the missing tutorials and then the old posts.
Again, I ask for your patience. This is not an easy task, especially when you have exams at University.
Almost there...
Contest Prizes!
Submitted by admin on Sun, 14/02/2010 - 12:19The prize of the contest "Helping Santa Claus", from the LusoRobótica.com forum, arrived this week.
Here is a picture:
1st place!
Surprise
Submitted by admin on Mon, 08/02/2010 - 02:33
So, the first surprise is here...
From now on, everything that is published in my website will be available, either in Portuguese and English.
This way, I expect to reach more Electronics, Robotics and Informatics enthusiasts.
I will soon start translating all my Personal Projects. I hope you understand this is not an easy task, so please be patient...
New Website
Submitted by admin on Sun, 07/02/2010 - 23:50Hello everyone!
It became unbearable to keep using the free Wordpress.com service, due to the huge amount of information the old blog had.
To solve that problem, I've registered this domain and restructured the website.
I'm currently migrating all the information from the blog to this new space. If you detect anything abnormal, please let me know.
My priority goes to the personal projects pages, because they were much visited.
However, some comments will be lost and the time of the comments may be changed.
Just to conclude, in the near future, there will be new sections and some surprises.
Best regards.
Festival Nacional de Robótica 2010
Submitted by admin on Mon, 14/12/2009 - 13:25Está aí a chegar o Festival Nacional de Robótica 2010, que vai ser em Leiria (Batalha). De 25 a 28 de Março.
Estas são as categorias quevão a competição:
- Provas Júrior
- Busca e Salvamento Júnior (BSJ)
- Dança Júnior (DJ)
- Futebol Robótico Júnior (FRJ)
- Provas Sénior
- Condução Autónoma
- Futebol Robótico Médio
As inscrições estão abertas:
- Pré-Inscrição: de 4/Dez a 31/Dez
- Inscrição Final: de 11/Jan a 18/Fev
Este ano tenho de ir... Já que não fui o ano passado, deste não passa.
Vêmo-nos por lá. ;)
LEDs Bi-Direccionais
Submitted by admin on Wed, 28/10/2009 - 21:50O que é que se pode fazer com um LED? Resposta: apenas luz. Errado! O que se pretende com este artigo é exactamente mostrar que os LEDs, para além de dispositivos de Output também podem funcionar como Input.
Estudos realizados comprovam que se acendermos um LED e invertermos a sua polaridade muito rapidamente, o tempo que o LED demora a ficar a zero depende da luz ambiente.
É claro que quando digo tempo, estamos a falar de fracções de segundo, que não se notam a olho nu, mas que um microcontrolador consegue medir.
Como funciona?
Pin 1 OUT HIGH -------( + LED - )------- Pin 2 OUT LOW Delay 50ms Pin 1 OUT LOW -------( + LED - )------- Pin 2 OUT HIGH Pin 1 IN Medir tempo que Pin 1 leva a ficar 0 Repetir desde o início
Quando nós temos muita luz, o tempo vai ser menor.
Por outro lado, quando temos pouca luz, vai demorar mais tempo.
Experiência
Confesso que no início estava séptico em relação a estes conceitos novos. Fazer do LED um dispositivo de entrada é algo que nunca tinha ouvido sequer falar, muito menos tinha visto. Portanto, não há nada como testar.
É possível testar a validade destas novas ideias através do Arduino, utilizando apenas 2 Pinos e a porta de série.
O código:
- int p1 = 2;
- int p2 = 3;
- int wait = 50;
- int value;
- void setup(){
- // Desactiva as resitências "pull-up" embutidas no Arduino
- _SFR_IO8(0x35) |= 4;
- _SFR_IO8(0x35) |= (1<<4);
- pinMode(p1, OUTPUT); // Define p1 como uma saída (OUTPUT)
- pinMode(p2, OUTPUT); // Define p2 como uma saída (OUTPUT)
- Serial.begin(9600); // Iniciar a ligação serial
- }
- void loop(){
- value = 0;
- // Emitir LUZ
- digitalWrite(p1, HIGH);
- digitalWrite(p2, LOW);
- delay(wait);
- // Trocar os potenciais : LED = -5V
- digitalWrite(p1, LOW);
- digitalWrite(p2, HIGH);
- // Trocar o modo do pin
- pinMode(p2, INPUT);
- // Medir o tempo que o p2 leva a ficar a LOW
- while(digitalRead(p2) != 0)
- value++;
- pinMode(p2, OUTPUT);
- digitalWrite(p1, HIGH);
- digitalWrite(p2, LOW);
- //Serial.println(value, DEC); // Tira os // se quiseres mostrar o valor na consola
- }
Façam upload do código, abram a Consola e confiram que o valor altera para diferentes luzes ambiente. Podem acender e apagar a luz, ou iluminar bem o LED e passar a mão por cima dele.
Mais além
Se quiserem ir mais além, lanço um desafio. Façam um 2º LED acender, conforme o valor inferido pelo 1º LED.
Depois, adicionem novos pares e façam uma fila de LEDs, e criem um efeito com os dedos a passar por cima dos LEDs sensores.
Boas experiências ;)
Exemplo
Aqui está um exemplo do que se pode conseguir através deste princípio.
Fontes de Informação
http://projects.dimension-x.net/technology-and-projects/ledsensors
http://cs.nyu.edu/~jhan/ledtouch/index.html
http://www.edn.com/article/CA150821.html


Ricardo Dias