Tuesday, August 1, 2017

More adventures with my Huawei Mifi device and TIM 4G

After some adventures with Vodafone (the signal is absolutely bad here around the lake), I can definitely confirm Telecom Italia (TIM) to be rock solid around the central area of the lake.


We're in a region where it's difficult to obtain a raisonable ADSL line and here we are getting a signal strong enough to support LTE at speeds of over 50Mbps download and 40Mbps upload.

Quite a good job TIM !

And the promo they are running now is quite unique too. 19,99 € for 30GB of internet traffic, 9,99€  for 10GB. No strings attached. 

Sunday, November 6, 2016

Converting Serial Cable for UNI-T UT61E to USB

A while ago, I bought a UNI-T UT61E  to replace my 20 year old DMM, so I was very pleased about the new features compared to my old meter. The cable supplied with the multimeter is only RS232C and because neither my desktop nor laptop have such a port, no further investigation was done.

While cleaning up my desk, I found the software CD of the UT61E and it reminded my of the lacking USB connection for my DMM. So I checked to see if this could be upgraded to USB.

Sure enough I found this article and it looked simple enough to make the conversion myself.
Well, after tinkering around and trying to implement the same schematic, I couldn't make it work.
Not with a CH340 nor with 2 other models of PL2303 USB-serial converters. No matter what I did, the serial monitor would produce only garbage.

So, I decided to give it another go and go back to basics. I checked around what I had lying around in my stock and found a couple of DIL and SMD packages of 74HC02 and 74HC04.
Schematic using logic gates
I first mounted everything on a breadbord using the DIL package and experimented with the correct resistance R1. It turned out to work just fine with 1kΩ. The header CON1 is connected to the corresponding pins of the USB-Serial converter (CH340 or equivalent). It works both on 3.3v and 5v.

Next step was to depopulate the original pcb inside of the IR-receivr. I only kept the IR-diode.
 
I then put some kapton tape on the backside of the board and soldered everything as tested on the breadboard. I replaced the standard through hole components by SMD components. I reused some solder pads on the PCB as mount points for my cable. This also fixated the floating HC04 chip.
I kept 3 of the 5 wires. Brown = GND, White = VCC, Yellow = RX (actually TX, but it connects on the RX pin of the USB-serial converter).

After careful mounting and sealing of the IR-receiver, I was able to slide it back into place. As you can see, the setup with logic gates only takes minimal space inside the enclosure.

Because the UNI-T UT61E software only recognizes comports 1-4, I installed my CH340 USB-Serial converter on COM3. It works like a charm 

Saturday, November 5, 2016

Converting my Arduino Mini Pro NRF24L01+ datalogger for low-power use

 I have been running a datalogger on my Raspberry Pi for a couple of years. It receives measurements from other devices in my home using a NRF24L01+ transceiver. Reasons to use this technology are mainly :
  • cost 
  • isolation from internet/intranet
There are 2 types of clients sending data to the Datalogger :
  • Other Raspberry clients
  • Arduino Mini-Pro  
I did some experiments when I first tested the NRF24L01+ transceivers but I never managed to make the clients really low-power such as to make them independant from mains power.
I did some experiments with the Watchdog timer in order to put the Arduino in to PowerDown mode, but I never got satisfied with the battery life of the setup. I could cut down power to a level where my 3v NiMH (2200 mAh) could last approx 3 weeks.I use 8 WDT cycles of 8s in order to send ambient data approx. every minute to the central gateway.

This weekend I jumped back in to the power optimisations and here are the results :
  • Mode 1 : Running unmodified Mini-Pro (with powerled, LDO)
  • Mode 2 : Running Mini-Pro with powerled removed (1-1,5 mA saved)
  • Mode 3 : Running Mini-Pro with powerled and LDO regulator removed (-50%)
  • Mode 4 : Optimizing software in order to put NRF24 module in Power Down


VoltageMode 1Mode 2Mode 3Mode 4
3.3v1700 uA123 uA71 uA6,94 uA
3.2v1601 uA105 uA60 uA6,50 uA
3.1v1492 uA93 uA50 uA6,17 uA
3.0v1400 uA66 uA41 uA5,90 uA
2.9v1295 uAN/A33 uA5,67 uA
2.8v1188 uAN/A27 uA5,42 uA
2.7v1086 uA46 uA22 uA5,32 uA
2.6v985 uA41 uA17 uA5,16 uA
2.5vUnstableUnstableUnstableUnstable
The sequential gains were enormous.

The Power LED

The Power indicator LED on the mini-pro was eating away quite a substantial part of the energy budget, so this was easy to remove. Removing the series resistance was easy.

The LDO Regulator

The second surprise was the LDO sitting between VIN and VCC. As I power the Arduino directly from the VCC pin, I wasn't aware that the output of the LDO was somehow sinking 40-50% of the remaining energy budget. Since there wasn't a jumper on my board, I decided to unsolder the LDO.

NRF24 issues
When comparing the energy use of the arduino without the nRF and with the nRF, I noticed a substantial power use by the nRF24 (71µA total current= 5,5µA Arduino + 65,5µA nRF24).
2 observations :
  • No use of radio.powerup or radio.powerdown in my code 
  • Excessive power consumption (60µA instead of 22µA in Standby Mode)
After adding the necessary radio.powerUp() and radio.powerDown() commands in my code, I couldn't see any difference in my measurements.
On the website of Nordic Semiconductor I found a forum post talking about excessive power consumption and it seemed to be related either to faulty soldering or ESD damage.
So I decided to throw out the module in use and replace it by a brand new one from my stock.
And guess what. Power consumption dropped dramatically. The nRF module went finally into PowerDown mode and only consumed approx. 1µA in this state.
The final result was a staggering 7µA @3,3V downto 5,4µA @2,8V. Below this voltage, the reading of the 1-wire temperature sensor becomes unstable and at 2,5V the reading is impossible.

I'm currently testing my module  on a Li-ion battery (3.6v - 2400mAh) and logging the battery voltage in my ambient sensor data.

I'm curious to see how the battery behaves.

Tuesday, August 16, 2016

TIM and Vodafone Customer Service experience - some ramblings

I have been using the Telecom Italia mobile network for years. The connectivity was more or less ok, until I discovered last year that the 3G was very saturated and the 4G not really present with sufficient bandwidth.
As you could read in my post about using a 3G key on my Openwrt router, the performance of TIM absolutely bad whereas Vodafone would give me descent speeds, even in 3G. So I switched to Vodafone.
This year my experience was a bit different.
First I had to deal with a Vodafone sales point in Lecco, that tricked me into buying a new SIM-card in order to activate my 10GB 4G deal. I lost 15 € in the process, 10 € for the new SIM plus I couldn't reuse the 5€ pre-existing credit on my old SIM. When trying to speak to the helpdesk, the operators were quite knowledgeable about procedures but the procedures are a rip-off. You can move credit from one SIM to another, but it costs 5€. If you deactivate a SIM, you can claim the residual credit and transfert it to another SIM. This can only be done in a Vodafone sales point, so I kept this for some other time.
In the meantime I had my Galaxy S5 act as a Wifi hotspot and it worked like a charm. Except 1 little detail : the 3 mobile phones, 1 tablet and 2 laptops were consuming close to 1GB a day. I had to find a solution to extend my 10GB allowance for data. I could activate a voice SIM with a contract and double my volume or I could buy another 10GB at Vodafone.
After my bad experience in the sales point I decided to have a look at other mobile operators. I was underwhelmed by the mobile coverage of Tre and Wind in my region, so I was stuck with either TIM or Vodafone.
I decided to give it a go with TIM and went to one of their resellers in Lecco. Oh boy, was this a mistake !
Here's what I planned to do : buy a Mifi (Huawei 4G LTE) and get 20GB of LTE data traffic for 1 month for free. I needed a Mifi anyway in order to free up my S5 and the prices where very competitive (79,90€ for the Huawei, SIM included, 1 € credit after activation, 20 GB of free data volume for 1 month).
First 1 had to battle the shop, because they were pissed because I was better informed than they were. They tried to trick me into buying an additional data plan, on top of my free 1 month promo.
The following week, was a week of misery :
- after 48h there still was no data plan active and the 119 was still sending me back to the shop ;
- the shop would send me back to the 119 ;
- I finally gave on the 119 and began to tweet on the Customerservice of TIM (day 4) ;
- Customer service on Twitter seems to behave like a robot service redirecting dialogs to private tweets. But I would never get replies on my private tweets, so I had to send a couple of angry public tweets with hashtags pointing to terms like 'fake', 'rip-off' before I eventually got a real human answer on day 5 (they opened a ticket at the technical customer service).
- On day 7 I received a phone call from an operator confirming the activation of Data plan, the reimbursement of 4€ incorrectly charged when I inserted the sim-card in my Huawey on day 5.
In the meantime, I survived by putting my Vodafone SIM into my Huawey (and changing the APN accordingly).
How could I survive that long without a proper dataplan ? Well, luckily Vodafone didn't get their act together and when my data volume exceeded my allowed 10GB, my Huawey remained happily connected to the tower station. And it remained until the end of day 7, consuming 17GB on a 10GB dataplan. And it only stopped because the kids disconnected the Huawey from the charger and the device ran out of juice.

In the meantime, I'm on TIM again and I was actually surprised by the good 4G coverage in the area. Being in a pre-alpine region, it's not obvious to get a good 4G LTE coverage. Any way, I wasn't expecting any descent coverage, but to my big surprise the signal is quite strong.

Big thumbs up for Telecom Italia. Their sales points are a catastrophy and their 119-operators seem to lack a working brain, but at least the second level helpdesk performed well and their network is solid.



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 !