Friday, August 7, 2015

[UPDATED] ALCATEL X215S 3G DONGLE on OPENWRT with TIM SIM

Here's the challenge :
- you have an old Omnima MiniEMBWifi (aka Edimax NS-1500) ;
- you have a 3G USB Dongle, in my case a TIM branded (but not locked) Alcatel X215S ;
- you want to share the internet connection ;



The thing is, nobody uses such an exotic RT3050F based router with 8MB Flash and 32MB Ram, 1 Ethernet port, 1 USB 2.0 Port and 1x1 (150Mbit) 802.11n wireless functionality.


First thing to do is to follow the guideline for 3G USB dongle installation on the openwrt.org wiki .

I first tried this on the stable release of Barrier Breaker, but in the end I switched to Chaos Calmer RC3. The usb-modeswitch functionality was much smoother and less kernel panics when disconnecting the 3G modem.

Good to know is that the X215S is very well supported and the modeswitch works like a breeze.

There's only one issue with the X215S : it's not working on ttyUSB0 but ports 3 and 4 are actually the modem ports !

I first tried ttyUSB3 but it wouldn't let me dial in minicom. ttyUSB4 worked just fine. So I decided to set my router up using /dev/ttyUSB4.

I modified the /lib/netifd/proto/3g.sh file and bumped the baudrate to 460800. Replace 115200 by 460800 in the script (almost at the very end of the file).

The /etc/config/network file is pretty standard (just follow the standard wan configuration) :
- username / password = */* ;
  • option username '*'
  • option password '*'
- no pincode set (because my SIM hasn't one) ;
  • # option pincode 'xxxx' or just delete this line
- apn = ibox.tim.it ;
  • option apn 'ibox.tim.it'

If you re-use the wan interface, you won't need to review the firewall settings. It's all explained in the guideline on the wiki page.

I use the /dev/ttyUSB3 in order to get RSSI indication by issuing following command :
- gcom -d /dev/ttyUSB3

 One both files are modified, you only need to reboot the router, insert the USB dongle and that's it !

What I still need to figure out, are the connection parameters for my Vodafone SIM. The connection stalls after the authorisation part. Not sure if I need to tweak the pppd-parameters. This is work in progress ... At least I now have my (not so speedy) TIM connection shared to my other devices.

[UPDATE]
Figured out the parameters in my pppd script to connect to Vodafone Italy using a data-SIM.
Add following parameters in the /lib/netifd/proto/3g.sh file or add pppd_options in the /etc/config/network :
  • noccp noipdefault persist
 Don't forget to set the correct APN for the new provider.

Have fun !




Thursday, July 30, 2015

[SOLVED] Vodafone Data SIM on Galaxy S5 issues - Problemi SIM Dati Vodafone su Galaxy S5

Let's start with the precondition of my current adventure :

I have following devices at hand :
- Samsung Galaxy S5 running stock Android Lollipop (5.0) Baseband G900FXXU1BOD3 ;
- Samsung Galaxy S2 running stock Android ICS 4.0.4 ;
- Samsung Galaxy TAB 8.9 (GT-P7300) running stock Android ICS 4.0.4 (Baseband P7300XXLQ6) ;
- Alcatel Onetouch x215s USB-dongle 3G (TIM branded, but not locked) ;

I happen to be in the possession of following SIM-cards :
- Data SIM Vodafone Italy - Giga Maxi (10GB traffic on APN : web.omnitel.it) ;
- Voice SIM TIM Italy - SuperGiga (20GB traffic on APN : ibox.tim.it) ;
- Voice SIM Proximus Belgium - 5GB Data and 300MB Roaming on APN: internet.proximus.be ;

I'm currently on vacation in Italy and I have a fairly good coverage with TIM and VODAFONE where I currently reside. TIM seems to lack capacity : HSPA and HSPA+ almost never exceeds 500kbit (up/down). LTE is not available in my area. Vodafone seems to have a better base-station position and I have HSPA and 4G (LTE) with a surprising good speed (for the area I'm in) : during day 6Mb down/2Mb up, in calm period upto 12Mb down/ 8Mb up. This is ... when I manage to register on the network.

Here comes the catch.

When I put my Belgian SIM in any of my devices it just works. The APN is automatically selected and everything works just fine.

s2 + Proximus SIM : Connection is 3G (HSPA,HSPA+) on Vodafone network : speed > 2Mb  up/down;
s5 + Proximus SIM : Connection is 4G (LTE) on Vodafone network : speed > 5Mb up/down ;
Tab 8.9 + Proximus SIM : Connection is 3G on Vodafone network : speed similar to S2 ;

This of course is unsustainable because of my ridiculous small roaming allowance (300MB).

So I try to put my TIM Italy SIM in my devices. The APN is automatically selected and everything works just fine. On the Galaxy TAB I need to delete the wap.tim.it APN.

On all the devices data voice and data works OK, limited by the available bandwidth on the base-station in my area. With some luck 500kb, once in a while almost 1Mb but most of the time rather 200kb. A lot of switching between HSPA,HSPA+,UMTS (you see constant switching between H,H+,3G).

My initial plan was to stick with  the TIM Data plan and use a hotspot to share the 20GB with my family. Well, you imagine already ... with the constant switching between the different modes and the low bandwidth, the Wifi Hotspot isn't capable of delivering a useful bandwidth to the different clients around (2 Mobile Phones and a laptop). Even with 1 device connected, it isn't going anywhere.

Because the Proximus SIM is roaming on Vodafone, and it has a really decent bandwidth in 3G and 4G, I got myself a Data SIM with a data plan of 10GB. In the shop they assured me that it would work on my SGS5. I only need to assign the right APN (web.omnitel.it).

That's the theory. In practice, during my first try (4hours after activation of the SIM) nothing useful happened. My SIM registered on the network, but it didn't get any data-connection on web.omnitel.it.

The Vodafone Data SIM is delivered with 3 APN preconfigured :
- mobile.vodafone.it : for regular browsing ;
- web.omnitel.it : for tethered browsing - needed for Giga Maxi data plan ;
- mms : of course for MMS use ;

Whenever I activated the web.omnitel.it APN, it would revert a couple of seconds later (while still in the APN menu) to mobile.vodafone.it. It got me suspicious because I was told, it would eat into my prepaid credit on my account.

After a couple of hours messing around with the Vodafone SIM, rebooting, etc etc I got the connection working and I could test my setup for a while ... until the next morning ... it wouldn't connect anymore.

When I install the Vodafone Data SIM in my other devices, none of them work. The data symbol (G,E,3G,H,H+ or 4G) never lights up. Regardless of what I do (order of events, APN settings, reverting back to standard, etc etc).

Only exception is my SGS5 where I need to perform following trick to make it work.

 Insert Proximus SIM into SGS5 and let the SIM register on the Vodafone network. Data is ON.
Deactivate Data, shutdown phone and swap SIM with Vodafone SIM.
Switch on SGS5 and let it register on the Vodafone network.
Activate Hotspot. Let it create hotspot and make sure it is up. Connect a client to the hotspot (other phone or laptop).
Now activate data and make sure the right APN is active (web.omnitel.it).
Now reconnect a wifi client to the hotspot. You should get internet access.
If not, then disable and enable hotspot on SGS5. Reconnect the wifi client.

If this sequence is not respected, symptoms are :
- No data-connection at all on SGS5 : no matter what you do, no way to get data connection up ;
- Data-connection is working for SGS5 but the hotspot wifi clients have no internet access after a few seconds ;

In both cases, you have to swap SIM's and apply the above procedure carefully.

Whenever the Wifi Hotspot is deactivated (after timeout specified in Android or manual) the data connection may again be lost. Only way is to proceed with the SIM-swap procedure.
Trying without SIM-swap doesn't work. There needs to be a new combination provider/SIM/mobile phone before retrying a registration of the data SIM. Don't ask me why (I'm just guessing).

I tried to speak to customer service, but they don't seem to grasp the problem. And because I'm using my own workaround, they don't seem to bother much. Because I don't have a voice-plan with Vodafone, I can't really call them, so I tried Twitter but it's slow and the 130 char limitation is not helping either.

One could argue that I'm pushing the limits by using a Data SIM on my SGS5, instead of using a Mifi device, a 4G-USB dongle or just the tablet as advertised on their website.
But even on my Galaxy Tab 8.9, it doesn't seem to work out of the box.I tried to extend the connection type by adding 'internet' to the pre-exisiting 'dun' type to no avail.

I'm going to the shop tomorrow with my gear and will show them what is going on with my SGS5. If they could just fix my SGS5, I would be very happy.

And next year, I'll get myself a Mifi or a cheap 4G-dongle on my NS-1500 Openwrt box. Any suggestions are welcome.


[UPDATE]
Went to the store, and they were in total disbelieve. They saw my actual data traffic I used in the last couple of days and they thought my SIM was fine. Until I asked the storemanager to install the data SIM in his device : he couldn't even send text-messages with my SIM.
Conclusion : they performed a RESET of the SIM because there was a configuration issue with the SIM. The reset procedure takes between 15 and 30' and when I switched-on my phone after this 'reset'-period, everything was working just fine without any workaround. Pfew !










Sunday, February 1, 2015

LUA and ESP-8266 - What a wonderful world !

Guess what, I bumped onto a blogpost discussing a cheap Wifi-module for Arduino. A sub 5USD module with an embedded ARM processor on board. Unbeatable price and feature set !

After doing some research, I bought the ESP-12 module on Aliexpress :
It's a stamp-sized module, with a serial port and a bunch of GPIO's :
I connected my USB-Serial convertor (I have a CH340G with selectable 3.3/5V) and after figuring out the correct pinout , I flashed the LUA-firmware on it.

ESP8266CH340G-SerialUSB
VCCVCC
GNDGND
RXTX
TXRX

Holding GPIO15 = LOW, and CH_PD = HIGH activates the module.
Communication is possible @9600,8,N,1 in this mode.
Holding GPIO0 = LOW, brings the module in bootstrap mode and download of a new firmware is possible.

I chose to upload a new firmware :  nodemcu-firmware using the esp8266flasher.exe software.

From then on, you can talk to the module using the Serial.line and setup the module by either executing commands or by writing the lua.init file. I used a textfile with commands, allowing easy push to the ESP-module.
When reusing existing code, it is important to check the GPIO-mapping. In my case the LUA-Gpio's map as follows to the Hardware pins :

This means that IO (7) is actually using hw-pin GPIO13 !

Once the Module has been connected to the Wifi-AP, everything is straightforward.

Sending a command :
<< http://192.168.2.108/gpio7=0 >> will clear  GPIO13 on the board !
<< http://192.168.2.108/gpio7=1 >> will set  GPIO13 on the board !

Imagine what you could do !




Sunday, January 18, 2015

Using Computer Mouse as Scanning Device for Arduino

I happened to have a wireless keyboard/mouse combo lying around with a broken USB-dongle. Basically unusable for regular use, but of course ideal for some thinkering.

I recently read an article about using the image sensor as input device for Arduino or other MCU and I wondered if I could repurpose my mouse for this.

So, I took my mouse apart and found out it is based on the Avago ADNS-5030.

I first cut all the traces going to the local microcontroller, solder some pins on the sensor and hooked up my Arduino Mini Pro 3.3V/8Mhz as follows, I took the 3.3V power from the Arduino too :


NameADNS5030Mini Pro
VCC7VCC
GND6GND
NRST39
NCS48
CLK513
MOSI811
MISO112
Reading the datasheet, shows SPI has to be configured in SPIMODE 2 (Pol=1, Pha = 0). Clockspeed is 1Mhz, so the DIVIDER is set to 4.

A quick check allow to verify register 0/1 and to read ChipId and Revision, respectively 0x11 and 0x00.

I ran a small demo reading the Motion-register and reading the dX and dY movement. No big deal.

Now I wanted to make sure I could readout the 15x15 pixel imagesensor. For this you need to readout the Grabber-register (0x0B), check that the MSB is '1' and then use the 7 remaining bits as intensity.

I connected my IL9301 TFT screen to my Arduino and used the Adafruit GFX library to draw the pixels on the screen.

On the software side it's a bit tricky because IL9301 works in SPIMODE=3 and divider 2, so we are changing the SPI-parameters on the fly to make it happen.

This is the setup :
The image sensor has approx. 0,1mm pixel resolution, the 'e' on the TFT-screen corresponds to 1 character from the cardboard.


Sunday, January 4, 2015

Nokia USB Serial Cable hack for my Arduino Mini Pro

I happen to have a Nokia USB Serial Cable lying around. I used it to program my Openwrt router.
It was perfectly fine. I had cut of the Nokia connector and I used the 3 wires:

WireSignal
Black + ShieldGND
WhiteRX
GreenTX

This worked perfectly fine for all 3.3v gear connected to the serial lines.
Until the day I wanted to connect my Arduino Mini Pro (3V/8Mhz).

It worked ok, but there were 2 drawbacks :
- I needed to provide separate power to the Arduino ;
- Programming from the Arduino IDE, requires a manual RESET of the Arduino to start the download ;

After some research, I found out the Cable uses a PL-2303HX chip. On PIN 2, there's the DTR-signal  but it isn't connected. The Arduino IDE using this signal to issue a reset to the processor in order to put the chip in download mode.

So, I performed following changes :
- Cut trace leading to Black lead between the 2 solder pads ;
- Solder Red wire from Capacitor to Red wire ;

- Solder Blue wire from PIN 2 to Black wire ;




This effectively puts 3.3v on the RED wire, DTR on the black and leaves RX/TX/GND as before.

Works as a charm. I soldered some Dupont-lines to the end of the Nokia Cable, heatshrinked the connections and finally inserted the PL-2303 board back into the moulded housing and glued everything nice and thightly. In order to avoid confusion, I used BLACK for GND and GRAY for DTR.




WireSignalMini Pro
BlackGNDGND
WhiteRXRX
GreenTXTX
Red3.3VVCC
GrayDTRGRN