Tuesday, August 7, 2012

Custom firmware on my trendnet 652BRP

I have a few routers, most of them with the dd-wrt custom firmware which I love. But there is one ugly duck in the pack, my trendnet TEW-652BRP V2.1. This revision is not supported by the dd-wrt... UURRR!!!
Lucky me, I found a link of somebody that compiled the GPL version of the firmware and changed it's functionality to be in Client Mode.The firmware can be downloaded from https://sourceforge.net/projects/tew652brpv2wcl/ .



What the firmware does?
The router operating mode is changed from Access Point to a Wireless Bridge. The router now is in Client Mode. When on client mode, the router accepts up to four wired devices and link those connections to a wireless network. This now accepts up to four devices wired to it. I had just connected one, but in the web site it says up to four.

Pros:
1. The router gets to be a bridge for up to four devices

Const:
1. In order to change to be an access point you need to flash the original firmware of the device.

All this is possible for curious people and open source. If more

If you have only one router, do not use this firmware. This is only if you want to use your router now as a bridge to provide wireless connection to some wired only devices, like a DVD player, TV set, media player...


I have nothing to do with this firmware, just found it downloaded it and installed. Since I liked it decided to share my experience.


Product picture from http://www.trendnet.com/downloads/list_subcategory.asp?SUBTYPE_ID=1259#

Tuesday, July 10, 2012

Escribiendo por escribir: Semana de Pruebas

Durante estas ultimas semanas he tenido la oportunidad de utilizar nuevos softwares. Al menos nuevos para mi. Vivo constantemente buscando cosas nuevas y haciendo pruebas a ver que pasa.
Asi que el camino de la curiosidad me llevo a probar los siguientes softwares:
  1. Para hacer development me encontre con el Window Builder Pro el cual es un tool gratis que ya esta incluido en la version de Eclipse Juno. EL Window Builder Pro es hecho por google y se puede usar para facilitar la programacion de ventanas en Java. Multi-plataforma, lo use en mi maquina primaria de Ubuntu 12.04 asi como en una con Windows 7. Funciona igual asi que en tu OS favorito lo puedes intentar. Eclipse lo consigues en http://www.eclipse.org y ya esta incluido en la version Juno, asi que solo baja el Eclipse IDE for Java Developers.
  2. Para los usuarios de Linux, le recomiendo el XWindows de Cinnamon. Yo he intentado en multiples ocaciones a moverme de KDE a Gnome sin exito. Por multiples razones siempre he vuelto a KDE en total descontenteo con Gnome. Ahora descubri que existia otro XWindows llamado Cinnamon (disculpen que no lo conocia desde antes) y me ha encantado. Aun llevo par de dias con el, pero me gusta que esta simple y no interfiere con mis trabajos. Es solo una barrita abajo (como el taskbar) y puedo subir y bajar mis programas sin ningun problema. Ya veremos cuanto tiempo me dura la luna de miel.

Por ahora estos son los dos programas mas importantes que he estado usando por ahora y ya veremos como siguen portandose conmigo. Ademas de estos dos he estado usando par de cositas mas que me estan gustando con el update que se le hizo al SDK de android ya que el Google IO fue hace unas semanas.

Ya he escrito mucho para algo que no compone mucho. Si leiste hasta aqui mereces un premio. Proximamente escribire algo con mas sentido.

Saturday, April 7, 2012

Mi Experiencia con USBasploader

Como parte de mi desarrollo con Arduino y el microcontrolador Atmega328 decidi intentar probar el USBaspLoader. Si conoces el Arduino has visto que el mismo cuenta con un circuito que convierte de USB a serial TTL. En versiones anteriores se utiliza el FTI mientras que el Arduino UNO utiliza el Atmega8U2 o similar para traducir de USB a serial TTL. Ahora, la diferencia del USBaspLoader es que permite tener el Atmega328 sin tener que utilizar este convertidor sino solamente el chip y un simple circuito.
Si eres como yo, esto me parecio fantastico asi que junte algunas piezas y decidi montarlo. Y increiblemente funciona como esta documentado. Claro si lo vas a intentar asegurate de utilizar los fuses correctos, los cuales aparentemente estan en el Makefile por microcontrolador. El setting del micro que estoy utilizando los vi escritos en un blog por ahi.


El diagrama del circuito utilizado puede ser encontrado en el siguiente enlace https://metalab.at/wiki/Metaboard
Esto es perfecto si tienes todos los componentes exactos. Peor que pasa cuando se te terminan las resistencias exactas. Pues eso fue lo que me paso, asi que buscando por intertet. Primero el "pull-up" resistor que es de 1.5K en el diagrama del metaboard lo cambie por uno de 2.2K segun se puede ver en el diagrama de usbasp (http://www.fischl.de/usbasp/) asi que este valor si tienes 1.5K o 2.2K funciona igual (almenos asi me funciona a mi).
Las otras resistencias so las de 68ohms, estas tambien se me terminaron. Gracias al internet pude ver unos  post de alguien que mencionaba que valores entre 47 ohms y 100ohms deberian ser buenos como quiera. Entiendo que esto lo lei en el web de avr-freaks, pero no tengo el link exacto. Anyway, estas resistencias aparentan ser para controlar la resistencia asi que decidi utilizar 100ohms y para mi sorpresa funciono.
Asi que este serian valores probados en 5V y con el Usbasploader conectado a una laptop con Ubuntu.

Resistencias y valores alternos que en mi caso funcionaron
68ohms ==> 100 ohms
1.5K ohms ==> 2.2K ohms

Mi experiencia con el usbasploader es de algunas horas solamente y con los microcontroladores tampoco es mucha, asi que disculpen la falta de detalles.

Antes de quemar el bootloader en el atmega, recuerda programarle los fuses correctamente. Esta es la configuraciĆ³n que utilizo.

avrdude -c stk500v1 -p atmega328p -b19200 -P /dev/ttyACM0 -U lfuse:w:0xf7:m -U hfuse:w:0xdA:m -U efuse:w:0x03:m

Nota: En mi caso, he creado un procesador alterno llamado atmega328np con el ajuste del signature del chip. Esta configuraciĆ³n es importante ponerla en el .conf de avrdude. Claro, solo para lo que usamos chips alternos, los demas deben pueden quedarse como esta escrito..


Wednesday, March 28, 2012

Atmega 328 non p adventure


A few weeks ago I ordered a pair of Atmega328 non P version to use in my Arduino projects. Since I am curious took the challenge of changing the bootloader on the chip. Went online, read a lot of tutorials and success stories about the desired task. All seems so easy that I took on the challenge without hesitation.
Started by openning the ArduinoISP (commenting the include of the pins.h library file) and downloading to the board. Connected the chip and... "no bacon". Try and try again and no bacon. A few nights and a lot of hours latter finally got it working and my steps to success are listed bellow

Short steps.
1. Loaded a VirtualBox Windows XP machine after reading in some forums about a situation with Ubuntu 11.X where the kernel may cause the burning process to fail. (Couldn't explain but since tried everything else..)
2. Loaded the Arduino 1.0 tool set in the WinXP machine.
3. Modify the Arduino ISP baud rate to 9600 and commented the "pins" include at the beginning (will not compile with it).
4. Edited 3 files in the arduino directory tree (boards.txt and avrdude.conf and programers.txt). Change the signature of the Atmega328p chip in avrdude.conf my recommendation as I founded by someone else post. Just open the file copy all Atmega328p and change the name Atmega328p to atmega328 and change the chip signature. Also open boards.txt and copy paste the ArduinoUno settings to Arduino328UnoNonP rename the uno. To uno328. And the chip type from atmega328p to atmega328. Edit programers.txt and change the baud rate of the ArduinoISP to 9600
5. Close and open the ArduinoISP and select the new ArduinoUno328 we just created from the menu.
6. Select ArduinoISP as the programer. Put a capacitor between reset and ground. The exact value was taken from the official arduino web site. This prevents the arduino from reset. 
7. Select burn bootloader
8. Wait for it to finish, that should be all.


Files are not here since this post was from my phone. But should be updated latter with more details and files for easy reproduce.
The Ubuntu problem I had may not be an Ubuntu issue but I tried and tried till changed to a virtual machine with XP. Still I will continue trying to make it work with in Ubuntu without the virtual XP. I had a version of avrdude compiled myself with the Arduino1.0 also downloaded not installed from ubuntu repository. Maybe all my stupidity was the cause, who knows. Important thing is that it is working now like new!!

The Atmega328 non P is a possibility and can be found for less than $3 in mouser.com or in other web sites for a little more preloaded with the Arduino bootloader.

Tuesday, March 13, 2012

How to Root Motorla Atrix 2 , Ver 2.3.6

Today I am happy, cause found the link to root my motorola Atrix 2 and it WORKED!!
As a developer having a non rooted device is a pin, specially for me since I wanted to extract the database from a restricted location for debugin my app.
This method was not made by me, I just founded the link for the video and wanted to share with all.

Update: After the phone is rooted it stays rooted until I restart the phone, then it goes back to stock non rooted, (good... bad... it is your call, just saying so you know).

Wednesday, February 29, 2012

How to convert string to integer in Arduino?

Today just found myself having to convert a string to an integer in an Arduino. Had a code that did character to integer but not from string. So copy from here to there ended up with this function. And posted here just for anybody to use or have a starting point.
Here is the code, use it change it or don't use it. Hope this saves you some time.
 int8_t satoi( char *str, int len ){  
  int8_t r = 0;  
  for(int i=0; i<len; i++){  
   //Check if this is a number  
   if ( str[i] < 0x3a && str[i] > 0x2f){  
     // is a ASCII number, return it  
     r = r * 10;  
   r += (str[i]-0x30);  
   }else{  
    i = len; //exit!  
    r = -1;  
    break;  
   }    
  }  
  return r;   
 }  
 int8_t satoi( char *str ){  
  int8_t r = 0;  
  int len = strlen(str);  
  for(int i=0; i<len; i++){  
   //Check if this is a number  
   if ( str[i] < 0x3a && str[i] > 0x2f){  
     // is a ASCII number, return it  
     r = r * 10;  
   r += (str[i]-0x30);  
   }else{  
    i = len; //exit!  
    r = -1;  
    break;  
   }    
  }  
  return r;   
 }  

Tuesday, February 28, 2012

Progress on arduino tv remote

Today received the zener diodes needed for a virtual usb keyboard and lucky me it worked. I was able to load the virtual usb keyboard libs from the web and run a hello world.
Next step is to put it all together with the irda and ethernet code. I will continue on this tomorrow and hope to complete soon. After this would be a very nice post to share.
Building, programming and sharing would make me go full circle.


Sunday, February 26, 2012

Arming my arduino

Just a view of how looks like an Arduino with a cheap Ethernet module and an infrared led with corresponding receiver. Separated all is working. Is a matter of creating interrupts for multitasking.  If not possible then this could become a dual core arduino project. Oh and this build is missing more LEDs and an USB cable to emulate a keyboard. Oh and of course a mobile phone app.
I just want to complete this project to start using it. And write a post here about it.

Update:
Due to interrupts and clock limitation (also I tried and tried but could not make the two codes into one), the project ended up using two arduino chips. Each connected via serial. One emulating the USB Keyboard and one with the ethernet and IRDA. All this might be able to be resumed into just one arduino UNO board with a different firmware for the usb to serial chip and might look actually better and smaller.



Wednesday, January 25, 2012

Black Widow Arduino first take

A few months ago a friend and I ordered a pair of Arduino Black Widow 1.0 (an Arduino with Wifi). So after a very long time, today decided to plug it in. After searching on the web how to, and literally because I had no idea what to do.
First downloaded the Arduino IDE on Ubuntu and installed (that was easy). But after I had no idea where to start looking.  Googleing and a few Arduino wikis and got exactly what I needed. Some web server and libraries. Downloaded and BAZINGA! it is on the wifi.


If you have to do and you are a "newbee" like me:
1. Download Arduino IDE (my case ubuntu, from the software center like any other program).
2. The black widow is an "Atmel ATmega328P" so I selected from the IDE on Tools->Board->Arduino Duamilanove or Nano/Atmega328
3. Downloaded the Wishield library from the github repo https://github.com/asynclabs/WiShield
4. You may download as a zip file if you like. In that file there is a folder for examoples that you can download where ever, and the code .c,.h files freely I copied them into /usr/share/arduino/libraries/WiShield (Wishield had to be created by me) with "sudo mkdir /usr/share/arduino/libraries/WiShield" and copied the files files that were not in a directory from the Wishield repo into that new folder.
5. Restarted the Arduino IDE.
6. Opened the Web Server project, click on the play button, no errors so clicked on the upload button and waited.
7. Configure your WIFI password and the IP

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,10,5}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,10,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"MYSSID"}; // max 32 bytes
unsigned char security_type = 3; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"WAPPassword"};


8. It downloaded to the Arduino (ok you must had plugged the Arduino to your USB) so it took a little time (less that 30 seconds) and the blue led came steady ON indicating that it was on the network.
9. Went into my web browser typed in the manually assigned IP address of the arduino and that's it. It is online!

So now you and I officially deployed an app to the Arduino, let's see what else (some other day).
Oh by the way, my girlfriend said "What is that", and I like a good nerd "Oh this is an Arduino, a micro-controller that can be used for a lot of cool things...". Sadly she cut me short just by saying "Ok, I really don't care". So sad right! We nerds that is our cross.



Tuesday, January 10, 2012

Repo Sync of cyanogenmod 9

After long time with problems downloading the CM9 source code for Ice Cream Sandwich. Apparently is downloading now.
The error message that haunted me was:


Fetching projects:  95% (232/244)  From https://github.com/CyanogenMod/android_prebuilt
 * [new branch]      gingerbread -> github/gingerbread
 * [new branch]      gingerbread-release -> github/gingerbread-release
 * [new branch]      ics        -> github/ics
Fetching projects:  99% (242/244)  error: Cannot fetch CyanogenMod/android_frameworks_ex

In order to solve this from a forum (http://forum.cyanogenmod.com/topic/39528-cant-dl-source/) had the link for the correction in the manifest.

To fix I did this:
1. Replace the default.xml manifest file from SOURCEDir/.repo/manifest/default.xml with the one from http://r.cyanogenmod.com/#patch,sidebyside,11353,1,default.xml . (please use the new one)
2. In my case since the problem was with one specific project, I did removed completely the folder SOURCEDir/.repo/projects/framework/ex completely.
3. repo sync  (this fixed all and recreated the project ex with the correct stuff)

Now the actual compiling is the challenge, but fun to do. Programming = 0, just copy paste and commenting stuff. Maybe eventually something will come out. But every build takes a lot of time just to know that I'm still missing something.