Archive

Posts Tagged ‘tutorial’

Xtream Codes IPTV Panel 2.4.2 Review – Part 4: Tutorial to Change the Main Server, Backup & Restore the Database

March 20th, 2017 3 comments

This is the fourth part of a review about Xtream Codes IPTV Panel, software to become your own content provider, and manage streams, clients, and resellers. The first three parts:

  1. Review of Xtream-Codes IPTV Panel Professional Edition – Part 1: Introduction, Initial Setup, Adding Streams…
  2. Xtream Codes IPTV Panel Review – Part 2: Movie Data Editing, Security, Resellers, Users and Pricing Management
  3. Xtream-Codes IPTV Panel Review – Part 3: Updates and New Features for Version 2.4.2

Main Server Change – Part 1: New Server

Changing your Main Server could bring you troubles, if you do not know what you are doing. Many different reasons to change the Main server such as  crashes, new one. making a Load Balancer to be a Main Server…

Remember, it’s all about the existing backup, and you’ll restore your backup later, after successfully changing the Main Server. That is not difficult and everybody can do it. But if you install your backup with your former configurations-Servers etc, it will need some corrections after the backup install is finish, and for example all your Clients, Servers ( and your Old Main Server) will be in again after you install your backup.

I’ll try to explain what that’s all about and show different examples.

  1. Changing the Main Server sounds and looks pretty easy, piece of cake, right?

But let me tell you, it’s not! Be absolutely sure about what you are doing before. We start with “Manage Server” left side in the Panel.

Then you scroll down to the end and you’ll see this:

Click to Enlarge

Warning: Make sure that you took all necessary steps before you press this button, all will be gone in a flash… BEFORE YOU Press MAIN SERVER CHANGE

Step 1: Do a Manuel Backup; this is still possible, since Xtream-Codes thought it would be a good idea to take the manually install Backup-Button off the road, for later installing your FULL BACKUP again by yourself!. NOT A GOOD IDEA, Xtream-Codes!

Step 2: Do a fresh automated backup on Xtream-Servers.

  • Database Manager—Remote Backup Now

Step 3: Take your time to think about your scenario! What do you want to do? Changing to a brand new Main? Formatted the old one only? Making an Existing Load balancer Main now? You see? Different procedures. It needs different preparing on this step of the game.

You have to think about the existing BACKUP, with all your clients and streams in, right? Or you want to loose them? I guess not. Again, think about, that the backup and later installing of your backup contains all your streams, clients etc…but also the old Server configurations.

Have also your ROOT ACCESS from the Panel at hand, because after pressing the CHANGE-Main Button…it happened a few times, that I could not login anymore in the CMS without root user/pass. You can find this Root USER/PASS in your Client Area WHMCS with Xtream-Codes,

Click My SERVICES—-

Press this then after:

And you see all what you need after:

We now change the Main to a NEW ONE:

After pressing the Button

Click to Enlarge

A warning pops up, asking, “Are you Sure”?

Click to Enlarge

We press OK! Seat belt on, and then this should come (In former versions I was simply getting kicked out the CMS, and have to login with Root user/pass only, Admins could not. This seemed to be fixed to a friendlier follow up now…)

Click to Enlarge

Now you put your NEW MAIN’s IP and SSH ROOT Password in, also your MYSQL ROOT Password, if any. If you are not sure, then in most cases simply put your ROOT SSH in again. Also, check the SSH Port, standard is Port 22, except if you changed it before. Don’t care about the rest now; you can change it later easily. Your New MAIN SERVER will install now, if all necessary data’s was right. And after a couple of Minutes, your New Main is installed

Click to Enlarge

After Installation of your NEW Main is finished, you want to restore the backup. Like I said, Xtream-Codes gives you right now (Sure that they will bring it up again) only the choice to install a Remote Backup from Xtream Codes Servers. To do this, you do as follows: Go DATABANK Manager and you see all your Remote Backups

Click to Enlarge

Right click the curved red and green arrow (load Backup), and after you choose your Remote Backup, this shows up:

Click to Enlarge

Press OK, and you see that Databank with all your Values is restored.

NEXT STEP, like I mentioned already above: after your Backup is installed, you will see, that your former OLD MAIN SERVER seems to be installed again! YOU HAVE TO GO ‘EDIT-SERVER…EDIT MAIN… and CORRECT IP AND SSH! This will do it then!.

And after successful installing the new Main (if he is a brand new one) , and installing the Backup then after, you Main will show the former IP of your Main, cause he was still in the installed backup in!

No problem at all, simply go edit Main-Server, insert again IP and SSH Root Password, and right SSH port, commonly Port 22, if you don’t changed it in your New Main.

Click to Enlarge

It also appears that your Load Balancers need a FULL REMAKE

PRESS FULL REMAKE ALL LB’s

AFTER PRESS FULL REMAKE ALL LOAD BALANCERS, HERE WE GO

It is possible, that you have to have to repeat this action with remaking all Load balancers. But be assured, it will work.

This was Part 1 of CHANGING the MAIN SERVER. I guess you know, what follows later, the little bit more complicated procedure of Changing The Main under different scenarios:

  1. We make an existing Load balancer to a NEW MAIN
  2. The preparation to do this

Changing Main Server – Part 2: Convert Load Balancer to Main Server

Scenario: We want a running Load balancer as a new Main Server! The right now “running” Main we want to send in retirement, right? This example requires that you have a few Load Balancers up and running. In case you have only 2 dervers in total, it’s not so complicated at all. Like I said above, each scenario is different. There are Admins with 20 or more Load balancers, and there are small ones, with 2 or 3 in total.

Do exactly Step by Step as follows, no twisting, no turning, no upside down please.. 🙂

Step 1: You go to TOOLS left Side, and transfer temporarily all streams from the future Main Server to another Load balancer of your choice! That’s how I have done it, not sure it will work later if you go another way, letting the streams on the future Main (the Server is a LB right now), but we have to delete this Server later out of the Panel configuration to make him Main! Reason: After we push the Remote-Backup back in, he will appear as a Load balancer again, and we can’t make him a Main Server without deleting him in the Panel.

Go exactly this way right from the start! NO REMOTE BACKUP BEFORE!! (Still hope that Xtream-Codes will implement the old feature back in soon, because not many can handle phpmyadmin, to implement a databank backup by their own later, or they should put a “hint or kind of warning” in before, something like Remote Backup now? Just in case the Admin forget it! Remember also, that the cron job “Remote Backup” is only once each 24 hours, so better do this manually Remote Backup before.)

Click to Enlarge

In general, a good idea in safety reason, the Remote Backup’s, it is a way more safe then before. Here we go now:

Click to Enlarge

After you’ve transferred your Main Server’s streams to another server, check first, the Main is really empty, it will need sometimes 1 or 2 or more minutes, depending of the quantity of your transferred streams. Now we have an empty Main, it’s the one, we do not need anymore after.

We have also to transfer the streams from the Load balancer we want as a NEW MAIN, making him completely empty. No streams on it. We do the same with the Load balancer we want as Main now! We are transferring his streams to another Load balancer the same way we have done before with the Main who has to go.

Step 2:

We do a REMOTE BACKUP after we transferred all streams, and to be on the safe side, a manual Backup to your Computer as well. First you press BACKUP DATABASE (the Backup File will load down to your computer), and direct after, we press REMOTE BACKUP NOW (Backup is loaded into Xtream Codes Server).

Click to Enlarge

Step 3:

We go MANAGE SERVER and at the bottom we see Main-Server-Change again:

Click to Enlarge

Let’s summarize what we have done.

  1. We have the Main and the future MAIN now with no Streams on it
  2. We are still in the process to change our Main Server
  3. Backups are already made (we are with an empty Main Server and an empty Load balancer right now)
  4. We have all our necessary data’s, IP and SSH Root Pass from the Load Balancer we want to put as a New Main. Login data’s ROOT for our CMS, just in case…

After that, we go MANAGE SERVERS-EDIT SERVER-DELETE SERVER.

We delete the Load balancer we want as NEW MAIN. Now we can press the Button Main Server Change.

Click to Enlarge

All necessary follow up’s standing already in Part 1 above!

We are ready to go!

  • Just in case you forgot or out of whatever reason you prefer to do a manually “load” of your saved databank backup, it’s also possible with phpmyadmin later.
  • In case you cannot do, open a ticket, XC is happy to help you out!
  • Don’t forget, Xtream-Codes support is not open 24/7!
  • And one of the most important last steps, after successfully installed the new Main, don’t forget to switch the old former MAIN OFF!
  • Switch him off, or make a new install! and sure you have to sort out your streams later, balancing them again.
  • In all other cases, like you have only 2 Servers, the procedure is similar and not complicated, cause of your limited streams, and clients. This example was written in case you got a few more Load Balancers running.
  • Don’t hesitate to open a ticket in case you are in trouble, Xtream Codes will help you in any cases.

I hope this little How-To helps you guys a little.

Ray

How to Control Your Air Conditioner with Raspberry Pi Board and ANAVI Infrared pHAT

March 12th, 2017 6 comments

Leon ANAVI may be a full-time software engineer, but in his spare time he has started to develop open source hardware project with the help of others and by himself. Last year, I got hold of his RabbitMax Flex HAT for Raspberry Pi, and tested it with the provided LCD display, one temperature sensor, and a Raspberry Pi 2 board. The board also featured IR receiver & transmitter, and I tried to use it with my aircon remote control, but at the time I did not find a way to do it easily, and control my TV with LIRC instead. Leon has now made a simpler, smaller, and cheaper add-on board for Raspberry Pi Zero, and other Raspberry Pi boards with a 40-pin header, with 3x I2C headers, two IR transmitters, and one IR receiver. He sent me a sample of “ANAVI Infrared pHAT”, and after quickly describing the board, I’ll show how to I could control my air conditioner with a Raspberry Pi 2 board and his Infrared pHAT.

ANAVI Infrared pHAT

The top of the has the 3x I2C header for 3.3V sensors, a UART header to access to serial console, two x 5mm IR transmitters (IR LEDs), and one IR receiver (IR photo sensor). It also has an EEPROM to store the HAT ID.

Click to Enlarge

The other side comes with the 40-pin female header to connect to your Raspberry Pi board.

The board was designed with KiCAD, and the hardware design files are released under a “Creative Commons Attribution-Share Alike 3.0 United States” License on github.

ANAVI Infrared pHAT Connection to Raspberry Pi Board

There’s only one step: insert the board on the 40-pin connector of your RPi board. You can only make one mistake, inserting it the wrong way. It has to be connected in away that it covers part of the board.

I’ve connect it with a Raspberry Pi 2 board with a battery kit, but it fits even better on the Raspberry Pi Zero, or newly released Raspberry Pi Zero W.

Setting up Raspberry Pi, and Controlling the Air Conditioner with LIRC

It’s time to start software setup in order to control the Haier air conditioner pictured below.

You’ll need to install Raspbian, and some packages including LIRC, but I’ve already explained how to do that in RabbitMax Flex Getting Started Guide, so I’m not going to repeat those steps here, especially you can find them in ANAVI Infrared pHAT user’s manual too, and I’ll assume you have already setup your board.

The reason why I could record IR commands from my TV remote control, and not my aircon remote control last time around, is because aircon remotes send not only one byte but also status info each time. The trick is to use mode2’s “alternative display mode” to capture pulse/space data as raw config files.

Let’s do that:

Now I faced the IR receiver and pressed the power key on the remote control:

Wow, that’s a whole bunch of numbers, but that’s exactly what we need as those are the duration of the high and low levels of the IR signal. I have repeated the same command, but capturing 4 keys: off, on, up to 29C, and down to 28C.

Then we need to edit our lircd-haier-ac.conf file manually:

Note that you need to delete the first “big number” from each captured command. For example, I had to delete “4989552” from the first capture of the power key. If you want full control, you’ll need to record all keys. You may want to read lircd.conf manual to understand parameters like aep or aeps. I used the default values, but in case it does not work for you, or works unreliably, you may have to adjust them, possibly from data obtained using an oscilloscope. I did not have such problem, and copied the file to /etc/lirc/lircd.conf:

In theory, you can restart lircd from the command line:

but in my case, I always had troubles when running irsend command:

So I had to reboot the board with sudo reboot to enable changes. Later I used the reload command (to take into account the update config) after restart, and I could avoid a reboot:

Once it’s all working, we can list the keys we’ve just defined in lircd.cong:

To turn on the aircon:

Then I was not sure what action would happen when I recorded the up key once setting the temperature. So I first set the temperature to 23C to check whether it would increment the temperature to 24C, or set it to 29C:

And the later happened, which means you need to record all temperatures you want to set, and there’s no such thing as UP and DOWN keys.

You’ll already guessed how to turning off the aircon:

Then I realized that since “29C” and “28C” commands send the temperature, it might also send the power status, and indeed I can turn on the aircon @ 28C directly with with 28C command. So instead of recording keys for your aircon, you are actually recording “scenes” which you could name “night”, “25Cfanlowswingup”, “off”, and so on. I added 25Cfanlowswingup with temperature set to 25C, fan speed set to low, and swing set to up, added it to lircd.conf, and a single command would turn on the aircon and set all those values:

Pretty neat.

While the instructions above will work with any board with IR receiver (for first time setup) and IR transmitter, you may be interested in getting ANAVI Infrared pHAT on Indiegogo for $9 plus shipping ($5 to  $7). There are also other rewards including the pHAT, I2C sensors, and debug tools. The campaign has already surpassed its funding target ($500), and delivery is planned for September 2017.

Karl’s Home Automation Project – Part 2: 433 MHz / WiFi MQTT Bridge, Door & PIR Motion Sensors

March 2nd, 2017 11 comments

Karl here again for part 2 of my home automation project. We will be looking at how to automate your lights based on time of day and motion. In the first part we setup Home Assistant and uploaded firmware to basic Sonoff Wifi switches. Today we will setup a 433 MHz to MQTT bridge and some sensors.

433 MHz

Depending on your country 433 MHz is an open frequency to use to communicate with. There are hundreds of different types of devices that use 433 MHz to communicate information. We will be focusing on 2 today from Gearbest: WMS07 motion sensor (left) and WDS07 door/window sensor (2 parts, right).

I am not taking the door/window sensor apart, since it is super basic, but I’ve included some photos of the PIR motion detector.

Click to Enlarge

Click to Enlarge

433 MHz Bridge

While contemplating how to get presence on a per room basis I ran across this project. It monitors 433 MHz signals and publishes it to the MQTT server. It is a really an easy project. It also has an IR to MQTT feature. I did have an IR receiver and tested it but have not implemented it. He has some good instructions on his page so I won’t go over too much. You can do the bare bones version and just leave off the unused sensors. I also went an extra step and added a light intensity sensor and DHT sensor to the project. It can be found here. I am not going to add those to this write up because trying to keep costs down.

What you will need is

  1. NodeMCU $5.69
  2. H3V4F Receiver Module $1.21
  3. Prototyping board $2.88

That is all that is needed. For about $10 you have an inexpensive 433 MHz bridge. You can put in a box if you want and hide it in a central location away from interference. I would suggest soldering headers to your board just in case something goes bad. I didn’t at first and made my life a pain. There are a ton of 433 MHz receivers. I purchased all the ones on Gearbest and this is by far the best. I did upgrade to a superheterodyne but I am not sure it is any better. I upgraded because I wanted to put the door sensor on my mailbox and get a notification when the mail was delivered. It is about 200’ away and is a little spotty even with a new 433 MHz receiver. I used this antenna design (see picture on right), as it seemed to work the best

Coverage is the biggest concern.  I have a brick single story ranch style home about 2000 square feet and it covers the inside with ease and a lot of the area around the house. If you have a multi-story house or would need multiple receivers you would need to change the MQTT topics to avoid getting duplicates. Below is the final project. To be honest temperature is really the only thing that is useful to me, but wanted to see what could be done. I purchase the DHT11 and the readings are not good. If you want to do this go with the DHT22. Below is a mostly loaded bridge. I don’t have an infrared transmitter yet. I have a different one coming that does the encoding/decoding on a chip and will follow up when I receive it. I am hoping it will be easier/better than using the Arduino library.

Motion Sensor

The motion sensor itself is really easy to setup with jumpers. I suggest turning the LED off, and the time to 5 min after finished setting up with the jumpers. If you notice there is a micro switch in the top left of this picture. It is meant to be a tamper switch but I use it as a toggle switch to quickly turn off the lights. The motion sensor is meant to be used for a security system but I just have them sitting on night stands and corner tables. It works really well to override or turn a light on when Home Assistant ignores the motion. A little squeeze of the box and the light will toggle states on or off.

After your bridge is set up and connected take the motion sensor out and put some batteries in it. Run your batch file to see what code is being sent. For this one we need 2: motion and tamper. Write these codes down.

Home Assistant

Below is the YAML code that I am using with Home Assistant. I made it find and replace friendly. If you copy and find the 4 items below it should work. I think it is relatively easy to follow. It is the typical timed lamp on motion that is on Home Assistant website with some slight modifications. I had to add the turn off motion script because the motion sensors only sends when it senses motion. I also had to add the tamper toggle switch. When you are adding multiple sensors you can only have one “binary_sensor:” group and one “automation:” group etc.

Find/Replace Explanation
generic use livingroom or masterbedroom etc no spaces
5555555 use the motion number you found earlier
8888888 make up a number around your tamper/motion number
9999999 use the tamper number you found earlier.

 

Door Sensor

For the mailbox sensor here is an example. Same thing on this one run the batch file and find the open and closed codes. I have it send me a notification via pushbullet.

Almost there

We are almost there. Lights are turning on and off magically. Life is good. But there is one situation where it’s not so good. The gloomy day. With the automations above we cannot determine if the blinds are pulled or it is gloomy. We still need the lights to come on under those circumstances to make it really cool. In the next installment we are going to take the motion sensors above and add a light intensity sensor to them. We will be able to do this cheap. We still have a pretty good budget. With the bridge above you open yourself to a bunch of battery operated sensors. You can also control devices, as well, with a transmitter. Any of the transmitters should work on GearBest. You can get the one linked and throw away the receiver. It’s only $1.25.  If you have any questions or concerns feel free to leave a comment.

Item Qty Price Total
Initial Setup Sonoff Basic 5 $4.85 $24.25
Headers 1 $1.50 $1.50
USB to TTL 1 $2.54 $2.54
$28.29
Motion Sensors NodeMCU 1 $5.69 $5.69
H3V4F Receiver 1 $1.21 $1.21
Prototyping board 1 $2.88 $2.88
Motion Sensor 4 $7.03 $28.12
$37.90
Grand Total $66.19

Karl’s Home Automation Project – Part 1: Home Assistant & YAML, MQTT, Sonoff, and Xmas Lights

February 27th, 2017 24 comments

Karl here. I am here to write about my home automation project. First thing I want to say is that I am very cost conscious and I don’t mind putting in extra effort into the setup of things to keep costs down. I did invest a lot of time and had to do a lot of reading to get my project going. It took while and I received a lot of groans from my wife while testing. I am still in the process of tweaking things.

I started watching a series of videos on YouTube from Bruh Automation. He introduced me to Home Assistant. It got me really excited. He uses a Raspberry Pi as a server but I already had a Wintel Pro CX-W8 Smart TV Box which I use as a server. I run 3 Minecraft Servers, Emby Server, iSpyConnect DVR (2 IP Cameras), Unifi wifi controller, and now MQTT Server, and Home Assistant. Below is screenshot of mostly idle.

If it weren’t for iSpy it would be around 5-10% most of the time. Emby transcoding is the only thing that is stressful and it is not used much. The reason I mention this is because after purchasing a Raspberry Pi with power supply and case, you are not far off from getting a z8300 box. Only downfall is dreaded Windows update auto reboot. I finally looked into it and disabled it. If you decide to use a Windows box, I would make sure you are running 64bit windows. One advantage to using a Raspberry Pi is there is an image on Home assistant with the basics pre-configured and just need to write it to an SD card.

Server side Setup

I won’t go into too much detail on server side, as I installed Python, Mosquitto, and Home Assitant (I followed the guide on their site for Windows)

Python was a breeze to install and just ran the executable and went with defaults. I already had it installed for something else and I am running 3.5.2 64-bit. There are newer versions now. Mosquitto was the most difficult. I followed this guide but substituted Win32OpenSSL_Light-1_0_2j.exe approx 2MB. A k version is available now. Home assistant was easy and used pip.

Christmas Lights

It was a little before Christmas when I started researching home automation. I had been reading about these inexpensive Sonoff devices here on CNX and I found a project on Github for some custom firmware by arendst that enabled them to be controlled by MQTT. (While getting the link it looks like a new project has started with some additional features here). My wife really likes decorating for Xmas and we have 3 trees and lots of lights. She mentioned getting some timers and boom I had my opportunity and ordered them the same night. After receiving It took me a couple nights and I had a simple automation turning Xmas lights on and off at specific times and life was good. I got an extra one to play with until Xmas was over. I redeployed the rest  around the house after Xmas.

MQTT

I really had no idea what this was and it took me a while to grasp. You can use a cloud based MQTT if you would like, but I prefer to run my own. MQTT is a service that relays messages between devices. There are 2 main items topics and payloads. To be able to tell a switch to turn on you send payload “on” to a topic, for example, “cmnd/testbench/power”. The light turns on and it replys back to a topic “stat/testbench/POWER” confirming that the light is on and the message is received. Because we are sending “on” to the topic each device using MQTT will need its own topic. Topics are case sensitive. I made a batch file to subscribe to all topics for troubleshooting so I could monitor the messages. The # indicates all sub topics.

Sonoff

I picked the Sonoff basic but there are also different varieties that add additional features which are supported by arendst software.

Arendst  has been very active with this project and adding/tweaking daily. When I first flashed the device, I did find a defect and notified him and he had it fixed and uploaded within the hour. He has very detailed instructions on the Wiki. First step before flashing is soldering headers. (I link to bent headers…which I initially thought I made a mistake but turned out it was good. They are easy to straighten) A USB to TTL adapter is also needed to upload from Arduino IDE. I recommend one like this because it provides both 3.3 and 5V.  After downloading and setting Arduino up, I only set my WiFi password and SSID in the sketch. After it boots the first time, it connects to your wireless network. Find the IP address in your router, and pop the IP address in your browser to finish the configuration. Set the MQTT server credentials and topic and your done. I never setup credentials on the MQTT server so it accepts any login. Finally after everything is programmed you need to connect it to mains. Beware do not connect mains while TTL is connected.  I bought some extension cords locally. Cut them in half and stripped back a ¼ inch of the insulation. Extension cords use stranded wire so I tinned them with solder to avoid any stray strands from shorting out. Then I screwed them down on the terminals making sure polarity was correct.

Click to Enlarge

YAML

YAML is unforgiving. It is the formatting that you configure Home Assistant in. A single space will stop Home Assistant from starting. Luckily on this last update if you restart Home Assistant through the browser it will test the configuration file before actually restarting. I purposefully put an extra space on line 54 to show it is easy to find any mistakes.

Click to Enlarge

I also recommend Notepad++ for editing in windows. You can break your configuration down into different files but I like one. Notepad ++ allows you to collapse the parts you aren’t currently working on.

I recommend adding one thing at a time and restarting to make it easier to find errors. And making a copy of the last working config before adding more. In the config below there are 5 sonoff’s and an automation to turn the lights on and off at specific times. This is extremely basic. I also recommend setting up one new device and be conscious of naming. When you get your config working properly on your first new device I copy the config to a new blank text window and do a find/replace.

Below is the screen capture of collapsed parts, and and full config (minus personal info).

Notice the test bench is on later firmware and the MQTT topic is slightly different

Next Steps

So now I have a smart home, right? Not in my opinion. I can turn lights on and off with a schedule or with my smart phone or at the light by pressing the button on the Sonoff. To me this is not smart. Setting a schedule is OK, but then you have the lights on unnecessarily and wasting electricity. Only real option is to press a button on the Sonoff but what difference is that than flipping a switch. Taking your phone out takes way too long, and I feel like it is going backwards. Below are estimated costs so far. By far the Windows Box will be the most expensive part if you choose to go that way. You can re-purpose just about anything that runs Linux to be a server. One other option is to run Linux on an S905x.

Money Spent

Cost of server not included nor shipping.

Item Qty Price Total
Sonoff Basic 5 $4.85 $24.25
Headers 1 $1.50 $1.50
USB to TTL 1 $2.54 $2.54
Total $28.29

If you find this entertaining or want me to go more in depth on a specific aspect let me know in the comments. I have been finding my time setting it up very satisfying. I am able to do some hardware and software work. I hope this might get your interest in home automation going, and find out it is not hard nor expensive. I would like to state none of the products linked were provided by the sites. I purchased with my own money.

The plan right now is to do a 3 part post. In the next post, we will integrate some inexpensive motion sensors and door sensors using 433mhz, then finally modifying the sensors to include a light intensity sensor.

How to Use CHIP Board as a Linux Printer & Scanner Server

February 19th, 2017 13 comments

We have a Canon Pixma MP250 series multi-function USB printer connected to a Windows 10 laptop at home, and for several years, I had no problems printing from my Ubuntu computer to that printer. However, this setup recently stopped to work, and whatever I would do, printing would never start from my Ubuntu PC, even though the file was (allegedly) successfully transfered to the Windows 10 laptop connected to the printer. So I decided to setup my own printer server, as well as a scanner server since it’s a multi-function printer, using one of the boards from my collection. As I opened my cabinet, I wondered whether I would use an Orange Pi board, Raspberry Pi board, or Nano Pi board, but I needed WiFi since there’s no Ethernet in the office where the printer is located, and I found that Next Thing CHIP board was the ideal candidate as it comes with a USB port, built-in WiFi, and storage, and I paid just under $15 in total to have it shipped to South East Asia. So I’ll report my experience setting up CUPS printer server and SANE (Scanner Access Now Easy) on the board. Those are generic instructions working on Debian / Ubuntu, so they will other work for Raspberry Pi, Orange Pi, Nano Pi board, etc… via WiFi or Ethernet.

Click to Enlarge

While I reviewed PocketCHIP last year, I had yet to actually use a standalone CHIP board. I did not want to connect it to a display, so I used some of the “Headless CHIP” instructions to set it up. I used a micro USB to USB cable to connect it to my computer, and use minicom to connect to /dev/ttyACM0 with 115200 8N1 settings, and yould access the command line with chip / chip credentials:

Then I configured WiFi from the command line, by first listing SSIDs:

and connect to my the closest access point from the list above:

The next step is to check whether CHIP has successfully connected to the wireless router with the command:

That’s all good. The micro USB to USB cable works, but it was unstable in my case, with the two LEDs something going dark due to power issues, which means CHIP consumes more power than NanoPi NEO + armbian, as I’ve been running it from a USB port for several weeks… CHIP ships with Debian with XFCE4, so it might be a good idea to remove the corresponding packages:

Alternatively, you could flash Debian without GUI based on the instructions here.

So since WiFi had been setup, I connect the board to a 5V/2A power supply, and logged it to the board with SSH, and everything became much more stable. I received the board in the middle of the last, so I updated the system first:

Now that the initials setup was done, I could start the printer server setup, with the steps below greatly inspired from instructions on Next Things forums.

By default CHIP board hostname is  “chip”, so I changed it to something more specific by editing /etc/hostname and /etc/hosts, and replacing chip with CNX-PRINTER. You’ll need to restart avahi-daemon for the changes to take effect:

At this point, we can access the board with CNX-PRINTER.local instead of using the IP address or chip.local. So I could SSH to the board with:

If you are doing this from a Windows machine, you’ll need mDNS (Bonjour) installed for .local addresses to be recognized, and one way is to simply install iTunes.

The next step is to install CUPS server:

CUPS will start automatically, and the web interface will be accessible from the locahost interface on port 631, but since I have not connected a monitor, this would not be convenient, so we can enable remote management with:

At this point I could access the web interface by going to http://cnx-printer.local:631/ in my preferred web browser.

Click to Enlarge

If you have not already done so, you may want to connect the printer to the board’s USB port, and power it on at this stage. Now we can click on Adding Printers and Classes.

Click to Enlarge

and then click on Add Printer, which will switch to an HTTPS connection with a self-generated certificate, so you may get a warning, but you can safely add the certificate to carry on. You’ll then be asked for a username and password. Don’t login with chip user, but instead root. The default password is also chip, so you may want to change that in the board.

Click to Enlarge

The next page is called “Add Printer”, and my printer was automatically detected. So I selected “Canon MP250 series (Canon MP250 series)”, and clicked on Continue button.

Click to Enlarge

You can add some location information on the next page, and also remember to tick Share This Printer, before clicking on Continue. Note that if you’re going to use Windows clients, you may want to note the Printer Name, in my case Canon_MP250_series, as we’ll need it.

Click to Enlarge

The next page will show a list of models, but in my case everything was already selected, to I just had to click on Add Printer to carry on with the setup.

Click to Enlarge

Finally, you’ll be asked to define some default options, but again I did not change anything there, and clicked on Set Default Options to complete the setup.

Click to Enlarge

The next step was to fo the Printers in Ubuntu to see what I had to do to configure the network printer, and the answer is: Nothing at all. The new networked printer was automatically detected and added to the list of printers.

Click to Enlarge

I went ahead, and clicked on Print Test Page, and it worked beautifully, although it started a little slower than usual.

But the printer server won’t last long if it cannot work with my Wife’s Windows 10 laptop, so I followed some instructions on ArchWiki. First I went to Control Panel -> Hardware and Sound -> Devices and Printers, and clicked on Add a printer.

Click to Enlarge

In the next window, you’ll need to select “Select a shared printer by name“, and type the printer name.

Click to Enlarge

The URL should look like http://<hostname>:631/printers/<printer_name>, where <hostname> is the IP address or hostname, and <printer_name> the printer name shown in CUPS web interface. Once this is done we can click on Next, and you’ll be asked to select Windows drivers for your printer, once it is done you’ll get a confirmation the installation was successful.

Click to Enlarge

The printing server installation went pretty smoothly, and worked with both Linux and Windows clients. But my printer is also a multifunction scanner, so I’d also need to enable scan function too. I adapted instruction @ http://xmodulo.com/usb-network-printer-and-scanner-server-debian.html and SaneDaemonTutorial on Ubuntu.com using SANE. I did manage to make it work, but only once. I guess there may be a permission or systemd issue, and I’ll update the post once I find a solution. In the menatine, I’ll still report what I’ve done below.

Before we try the scanner over the network, we need to make sure it works locally inside the CHIP board. SANE is probably already installed, but to make sure we can install the following packages.

The following command will try to find scanners, and it could find my Canon MP250 series scanner connected via USB:

Another way to check this out is to use the following scanimage command line:

We can now try to scan one image:

The scanning started shortly after, and we’ve got our scanned file:

So far, so good. SANE is is working…

We can now configure saned (SANE daemon) to be able to access the scanner from the LAN. First we need to create /etc/systemd/system/saned.socket file as root with:

Please note that this differs from the instructions on Ubuntu as there seem to be an error. The line:

does not seem right, and would cause systemdctl to report a “bad message”, and the line at the top are ignored by systemd. I tried to edit the Wiki, but I could not due to a gateway error on the site.

We also need to create a separate file called /etc/systemd/system/saned@.service with:

We als oneed to enable access to computer on the LAN, by editing /etc/sane.d/saned.conf:

The exact IP address subnet will depend on your own local network configuration. We can now enable saned (so that it starts automatically), and start it as follows:

We can check the status with:

So everything appears to be going smoothly. We can now configure clients. Let’s start with a Linux client (my Ubuntu computer) to make sure it work. We can first install xsane, a graphical interface for saned:

And then configure sane to connect to our SANE daemon by editing /etc/sane.d/net.conf, and adding the hostname or IP address of our server, and enabling time out:

Time to start xsane from the command line or dash for some scanning, except it did not work for me with the window below showing up each time after a few seconds.

So I spent a few hours studying about this problem, reading articles online, capturing packets with Wireshark, and trying the same thing on a Windows client with SaneWinDS. I could not find any solution in any articles, but I could see packets exchanged between the server and client, and SanWinDS could connect the CHIP board SANE daemon, but would not find any device/scanner. I could not find anything relevant in /var/log. or dmesg either, so I tried to mess up with the config files, and changed saned@.service to use User=chip instead of User=saned, and success! I could start xsane, and scan a document.

Click to Enlarge

So I rebooted, the board to see what would happen, and sure enough it went back to the “no devices available” window. I tried to change that back to User=saned, and reboot, and then try again with User=chip, but I had no luck in all of my subsequent attempts, and ran out of time for the day… The solution is probably close, and I’ll update the post once/if I found out what the problem is.

CHUWI LapBook 14.1 Windows 10 Firmware, Drivers, and BIOS

February 13th, 2017 No comments

In case you’ve installed another operating system like Ubuntu on CHUWI Lapbook 14.1 laptop, and want to re-install Windows 10, CHUWI has released Windows 10 firmware, drivers, and LapBook 14.1 “BIOS” in their forums.

So I’ve re-installed Windows 10 on the laptop using the Windows 10 image. You’ll need to download the 8 files CHUWI LapBook 14.1 Windows.part1.rar to CHUWI LapBook 14.1 Windows.part8.rar, and after extracting them you should get a “CHUWI LapBook 14.1 Windows” directory with all necessary files to reinstall Windows.

The files take 8GB, so it may not fit on all 8GB flash drives, and you may need to use a 16GB or greater drive. I just copied the files to an 64GB flash drive formatted with NTFS, insert the drive into the USB 2.0 port of the laptop, and I could start the installation process at boot time.

Click to Enlarge

However, it quickly failed as it tried to install Windows 10 on the flash drive itself:

Virtual Disk Service Error:

The operation is not supported on removable media.

The system cannot open the device or file specified.

Then I remember I had to set the USB drive label to WINPE for this to work. So I have to repartition the drive, format it to NTFS, set the label WINPE, and copy the files again. I reinserted the drive into the laptop, and update started successfully and went much further this time.

Note that by default CHUWI LapBook 14.1 boots from USB first, but if you have changed the settings in the BIOS, you’ll have to press F7 at boot time in order to select the drive. The installation went ahead, and after a while the laptop shutdown. I removed the USB drive, and pressed the power button to carry on with the installation.

Click to Enlarge

At this point System Preparation Tool 3.10 windows pops up, and I just clicked on OK which rebooted the laptop again, and brought me to the usual Windows 10 setup wizard where you select the language, WiFi network, setup and account, etc…

I just went through it as usual, and everything works.

If you have one of the earlier model, and your BIOS is older than version “A2W6_NA14.012”, you may to upgrade the BIOS by downloading “LapBook 14.1 BIOS 20161230.zip” and extracting the files to a USB flash drive formatted with FAT32/NTFS, insert it in the laptop, and boot it to complete the update.

How to Upgrade to Linux 4.8 in Ubuntu 16.04.2

February 13th, 2017 14 comments

I had read from several news sources that Ubuntu 16.04.2 would come with Linux 4.8. My system was upgraded from Ubuntu 16.04.1 to Ubuntu 16.04.2 this week-end, but I still had Linux 4.4.

So I wondered why that was, and eventually found my answer on Reddit thanks to EndofLineLF user:

If it isn’t a new 16.04.2 installation then you won’t have newer kernel.

If your install started as 16.04 or 16.04.1 then with all updates installed “lsb_release” will display 16.04.2 as version because that’s what you have.

The switch to HWE (Hardware Enablement Stack) was never automatic. So if you want newer kernel you have to install it manually.

https://wiki.ubuntu.com/Kernel/RollingLTSEnablementStack#Packages-1
sudo apt-get install –install-recommends xserver-xorg-hwe-16.04

This will also install the new HWE kernel because it is recommended for that package.

Upgrading to the new kernel is completely optional, and Linux 4.4 will still get security updates, but I did it anyway, since I had an issue with the current Linux 4.4.62 kernel, although a fix with the next 4.4.63 release later this month. Anyway, I went ahead with:

After a reboot, I could confirm linux 4.8.0-34 kernel was installed:

If you run a Ubuntu 16.04 server installation, and want to upgrade to Linux 4.8, you may want to instead run:

One important note: If you switch from Linux 4.4 (GA) to Linux 4.8 (HWE), you’ll lose support for Canonical Livepatch Service.

Review & Quick Start Guide for Khadas Vim Pro Development Board with Ubuntu 16.04

February 11th, 2017 36 comments

Khadas Vim is the only Amlogic S905X development board I’m aware of. There are 4 or 5 versions of the board, but currently only two models are sold: Khadas Vim with 8GB flash and single band WiFi + BLE 4.0, and Khadas VIM Pro with 16GB flash, and dual band WiFi + BLE 4.2. SZWesion, the company behind the board, has sent Khadas Vim Pro for evaluation. Today, I’ll take a few pictures of the board and its accessories, and report my experience playing with Ubuntu 16.04.2 on the board. They’ve also released Android, LibreELEC, and dual boot Android/Ubuntu (for Vim Pro only) images, which you can find in the firmware resources page.

Khadas Vim Pro Unboxing and Photos

My parcel included Khadas package that looks like a book, an HDMI cable, and the same IR remote control sent with GeekBox, the first board made by the company, and powered by a Rockchip RK3368 processor.


You can indeed open the package like a book, and you’ll find the board and a USB to USB type C cable inside, as well as some basic specifications.

Click to Enlarge

You can verify you’ve got the right model on that back of the package which shows the memory and storage, in my case 2 GB + 16 GB.

The board comes with a neat acrylic case with opening for headers and ports. The top of the board features a 40-pin header, the Amlogic S905X processor (no heatsink), two RAM chips, the eMMC flash, the wireless module (AP6255), and most ports with two USB 2.0 ports, a USB type C port, HDMI 2.0a, and Fast Ethernet. There’s also a separate header close to the USB-C port giving access to Vin in case you don’t want to power your board through USB.

Click to Enlarge

There’s also 2-pin battery connector on the left of the board for the real-time clock (RTC). The bottom side of the board includes two more RAM chips, and the micro SD slot.

Click to Enlarge

Power, “function” and reset buttons can also be found on the side of the board, and there’s an IR receiver on the right of the 40-pin header.

Click to Enlarge

Ubuntu 16.04 on Khadas Vim (Pro)

While you can download the firmware on the “Firmware Resources” page, I recommend you check the Announcements & News section on the forums, as they normally include a changelog and some tips to configure your board. An Ubuntu 16.04 + XFCE image was released last month, but the company uploaded a Ubuntu 16.04.2 server image yesterday, so that’s the one I’m going to use today. A new Ubuntu 16.04 + XFCE image with better graphics support will be released sometimes next week.

My plan is to do the update in my Linux computer. The firmware is distributed through Mediafire, so you’ll have to download it through your web browser. I also downloaded  Vim_Uboot_170121.7z on the Firmware Resources pge since it’s needed for the SD card update method. Once we’ve got the firmware and U-boot binaries we can extract them with 7z.

Now insert the micro SD card inside your computer, find the device with lsblk, and check if it has more than one partition. Replace /dev/sdX with your own device.

If it has no partition or more than one, you’ll need to change the partition table using tools like fdisk, or gparted. The instructions provided on Khadas website are basically the same as I wrote in the post “How to Create a Bootable Recovery SD Card for Amlogic TV Boxes“.

Mount the partition, for example by removing and re-inserting the micro SD card into your computer, and copy two files needed for update:

Eject the micro SD card:

Now connect your board with the cables would want to use (e.g. Ethernet, HDMI. etc…), and possibly connect a USB to TTL debug board to access the serial console in case of errors. I also connect a USB hub with my RF dongles for air mouse, and a USB keyboard.

Click to Enlarge

The board comes pre-loaded with Android 6.0.1 with Linux 3.14, so you can connect the power first to make sure the board is working properly. Note that you’ll need to provide your own USB power supply. I used a 5V power supply, and not a fast charger found in some phone and starting at 12V. Now we can insert the micro SD card we’ve just prepared into the board, and boot into Upgrade Mode by keeping pressing on the power button (closest to the 40-pin header), pressing a short time on the reset button (closest to the USB port), and releasing the power button two or three seconds later. At this point, you should get a firmware upgrade interface on the HDMI display with a green progress bar, and once completed you’ll get a “Successful Android” logo.

This is what it looks like in the serial console during the update:

So I pressed Control-C in the serial console (if you have not set it up just reboot the board), and it failed to boot with the multiple error messages:

I contacted SZWesion about the issue, and they told me the SD card method did not work despite being documented on their website, and I had to use Amlogic USB Burning Tool in Windows instead. So I fired up a Windows 7 virtual machine, and I had no problem (for once) flashing the “update.img” file extract from Vim_Ubuntu-server-16.04_V170211.7z to the board.

Click to Enlarge

This time it works and the board booted properly. Here’s the complete boot log for reference: