RBox - its a lightweight linux distribution built with buildroot. Current update binary size of RBox is around 25MB.
Here is my compact IoT setup based on Pi Zero + 3G usb Modem +prepaid SIM card+ 5200mAH battery pack.
What does this setup do?
SDCard in this Pi-Zero boots RBox linux image, during linux bootup following activities happen.
What is so special about this setup?
FAQ:
1) how much 3g data is consumed with this setup?
Ans: if there is no chat-message traffic to this setup, there is just xmpp-heart-beat packet sent to the jabber server(in my case typical usage per day is around few hundred kilo bytes).
2)how long does the battery backup last?
Ans: i have 5200mAH battery, fully charged battery kept my setup alive for about 8 to 10hours(you can have higher capacity battery for increased backup time).
3)Can i deploy this setup in a off the grid remote location?
Ans: ensure that you have higher capacity battery along with large solar panel(especially during winter with very low sun light condition, you might need extra juice to keep setup running). Also Ensure that your setup is in 3G coverage area.
4)Is this project open source? where can i find the sources? how can i build the binary image myself?
Ans: yes, source code is hosted at this github location. Instructions for creating the binary image is given in the github location.
5)If i do, Over-The-Air linux image update, will this consume lot of my 3g-Data?
Ans: yes, compared to normal xmpp traffic, linux image Over-The-Air update consume about 25MB data per upgrade, but then, how frequently would you be upgrading linux image? if you keep on adding new features, you might want to do frequent upgrades.
6)What happens if battery or power to pi-zero goes off during Over-The-Air linux image upgrade? will this brick my remotely deployed pi zero?
Ans:Rbox upgrade mechanism reduced the chances of bricking. During the upgrade process, non-active partition is programmed with new image. After the image is written to non-active partition, boot flag is flipped and pi reboots with updated partition.
7)I see that you have stacked up pi-zero/3g-stick/battery, why did u do that? wouldn't this be simpler to use pi-zero-included mini-usb-to-usb-converter?
Ans: yes, initially i did this, this is how my old and new setup looks, i like the compact setup instead of dangling wires, moreover rectangular brick shaped setup is easy for designing a 3D printed case.
8) I see that you are distributing ready to use bootable-binary-disk-image, but what if i want to build the image by myself from sources?
Ans: Here are details for generating binary from sources.
9) what about two or more xmpp accounts controlling this pi-zero-IoT setup? will this work?
Ans: Yes, Raspi0 acts as an xmpp-chat-bot, like typical xmmp-chat-scenario between humans, raspi can have multiple "friends" authorized to send/receive messages. e.g: you and your wife having separate xmpp/jabber accounts can trigger house-door-opening after kids arrival from school. Similarly, raspi can send asynchronous chat message to multiple subscribers on an I/O event(e.g when kids ring the door bell).
10)How much does this setup cost? what are the running costs?
Ans: Total cost including all components and prepaid simcard shall not be more than 50Euros. Having a prepaid sim with around 100MB/30days data plan would be sufficient to keep the setup alive with basic I/O control and command traffic. Here in Germany, congstar charges 2Euros for a data plan of 100MB/30days. You need to decide for yourself based on your data-usage and provider's data plan.
11) I want to re-create the exact setup of your's, what parts do i need and what are the steps for creating sd card?
Ans: Items needed
Here is my compact IoT setup based on Pi Zero + 3G usb Modem +prepaid SIM card+ 5200mAH battery pack.
What does this setup do?
SDCard in this Pi-Zero boots RBox linux image, during linux bootup following activities happen.
- usb_modeswitch switches the usb 3G modem to act as modem instead of default memory stick behaviour.
- umts-keeper along with sakis3g script would establish internet connection and keeps the connection alive.
- gloox, c++ library based daemon starts and logs in to a jabber server using preset xmpp login username and password. this xmpp daemon acts as a chat-bot.
- using android xabber app, communicate and control your pi-zero-IoT setup using chat messages.
What is so special about this setup?
- very low cost setup < 50Euro(PI_zero + sdcard + 3g_stick+sim_card+battery_pack)
- linux image is mounted as read-only, power cut doesnt harm the sdcard data.
- OTA linux image upgrade - full linux image upgrade over-the-air can be triggered by sending xmpp chat message.
- No need to have special cloud based service or opening-up-the port on internet with special dyndns registration. you just need two xmpp(jabber) or gmail accounts. one for pi-zero, second one for your mobile phone.
- possible to dial ussd codes via xmpp chat message for knowing the balance amount of prepaid sim card.
- possible to send/receive sms from your 3g-stick using xmpp chat messages.
- acts as a sms-gateway with xmpp based remote access for sms sending and receiving.
- possible to control pi-zero gpio's by sending get/set-gpio chat messages.
- possible to execute shell commands on pi-zero by sending chat messages.
What are the typical application's of this setup?
- sms gateway - deploy this setup in your home country having local prepaid sim card, access your sms from anywhere in the world by sending jabber chat messages.
- weather station - deploy this setup within the 3g coverage area of your sim provider, along with solar panel and weather sensors, monitor the parameters by sending xmpp/jabber chat messages.
- fleet management - place this setup in your taxi/truck along with gps sensor, keep track of all your vehicles from a centralized control PC.
- wildlife monitoring - place this setup(along with camera) in 3G/Gsm covered forest area, monitor the activity of animals and take a picture and upload it on a cloud server.
- Remote asset management(e.g digital signage) - deploy this setup along with digital-signage display, control the content of your signage display by sending xmpp chat messages.
- Anti theft device - for cars, boats, mobile homes and caravans. let this device send you gps co-ordinates as chat messages when the pi-zero starts moving.
- Home automation - keep track of your holiday home, monitor temperature/humidity and control the relay's via gpio for switching on/off various devices.
- many more..
FAQ:
1) how much 3g data is consumed with this setup?
Ans: if there is no chat-message traffic to this setup, there is just xmpp-heart-beat packet sent to the jabber server(in my case typical usage per day is around few hundred kilo bytes).
2)how long does the battery backup last?
Ans: i have 5200mAH battery, fully charged battery kept my setup alive for about 8 to 10hours(you can have higher capacity battery for increased backup time).
3)Can i deploy this setup in a off the grid remote location?
Ans: ensure that you have higher capacity battery along with large solar panel(especially during winter with very low sun light condition, you might need extra juice to keep setup running). Also Ensure that your setup is in 3G coverage area.
4)Is this project open source? where can i find the sources? how can i build the binary image myself?
Ans: yes, source code is hosted at this github location. Instructions for creating the binary image is given in the github location.
5)If i do, Over-The-Air linux image update, will this consume lot of my 3g-Data?
Ans: yes, compared to normal xmpp traffic, linux image Over-The-Air update consume about 25MB data per upgrade, but then, how frequently would you be upgrading linux image? if you keep on adding new features, you might want to do frequent upgrades.
6)What happens if battery or power to pi-zero goes off during Over-The-Air linux image upgrade? will this brick my remotely deployed pi zero?
Ans:Rbox upgrade mechanism reduced the chances of bricking. During the upgrade process, non-active partition is programmed with new image. After the image is written to non-active partition, boot flag is flipped and pi reboots with updated partition.
7)I see that you have stacked up pi-zero/3g-stick/battery, why did u do that? wouldn't this be simpler to use pi-zero-included mini-usb-to-usb-converter?
Ans: yes, initially i did this, this is how my old and new setup looks, i like the compact setup instead of dangling wires, moreover rectangular brick shaped setup is easy for designing a 3D printed case.
8) I see that you are distributing ready to use bootable-binary-disk-image, but what if i want to build the image by myself from sources?
Ans: Here are details for generating binary from sources.
9) what about two or more xmpp accounts controlling this pi-zero-IoT setup? will this work?
Ans: Yes, Raspi0 acts as an xmpp-chat-bot, like typical xmmp-chat-scenario between humans, raspi can have multiple "friends" authorized to send/receive messages. e.g: you and your wife having separate xmpp/jabber accounts can trigger house-door-opening after kids arrival from school. Similarly, raspi can send asynchronous chat message to multiple subscribers on an I/O event(e.g when kids ring the door bell).
10)How much does this setup cost? what are the running costs?
Ans: Total cost including all components and prepaid simcard shall not be more than 50Euros. Having a prepaid sim with around 100MB/30days data plan would be sufficient to keep the setup alive with basic I/O control and command traffic. Here in Germany, congstar charges 2Euros for a data plan of 100MB/30days. You need to decide for yourself based on your data-usage and provider's data plan.
Ans: Items needed
- Raspberry pi zero v1.3
- Huawei E173 usb-3g-modem
- 8gb sdcard
- battery-pack
- four pogo pins
- general purpose pcb
- pcb mountable usb male and female connectors
SDCard Image creation:
- First and foremost is to have two xmpp login accounts on publicly available jabber servers(So far RBox has been tested with jabber.de/xabber.de and ubuntu-jabber.de). Follow my previous Post on how to create master and slave xmpp accounts(ensure that master/slave accounts have authorized each other to send/receive messages).
- Download the initial SDCard Image from here.
- Unzip the downloaded xz image using 7zip or your favorite decompression tool.
- Write the unzipped binary image to Sdcard using Win32DiskImager.
- After writing the image to SDCard, remove and re-insert the card on your PC. Your PC will detect a new drive as "boot" where raspi's kernel and boot images are listed.
- In this "boot" drive, create a new file called xmpp-login.txt and copy this text. After copy, edit this file and replace sample user and password with actual username and password of your slave-device which you created in Step-1(please note that your providers APN details may differ).
- Remove the SDCard from PC, and insert it into pi zero, wait for about 2-3 minutes for 3G Modem's LED to glow solid blue.
- On your android phone, open xabber app and login using master's username and password which you created in Step-1.
- If everything goes well, raspi-zero will show up as online on your xabber client.
- Send a "Help" to your raspi-zero, it will reply with list of available commands.
- Send "Sysupdate;reboot" and wait for raspi to update to latest RBox image, after update, it will reboot and be back online again with latest RBox version. Here is the detailed information on all available commands.
- for gracious shutdown, send "poweroff" chat message and wait for 3g Modem's blue led to go off.