Setup PI ZERO W as ultra portable server and AP (tutorial) updated to 2022 :)


The simplest solution would be to turn off auto updates for app. And do manual updates when necessary.

We will also simplify admin access soon. However, no compromise here. Either secured env. or simplicity :slight_smile:.

1 Like

i didn’t say the current way to set up admin panel is complicated, because it seems ok.
the problem rather was the not very clear composition of the docs, about the importance of the file. that should be edited a little…

I agree… I had Local Server up and running almost at the very beginning… but it took much longer tying to figure out the admin page before even catching onto the file.

But as stated… soon to get even easier :smiley:

ok, now i need some sleep. tomorrow i will get back with details how it goes.
thanks again, for everyone!

I didn’t mean you, I mean many other users :slight_smile:.

1 Like


just continuing with my wandering in the realm of linux and rpi… maybe will be useful for others. today i managed to configure the rest of the necessary stuff:

  • downloaded blynk server files from here

  • copy file into home/pi folder and make your modifications if necessary. i’ve changed here:
    allowed.administrator.ips= (only i will use this server, so no security concern)

  • reboot pi

  • start blynk admin panel in browser, give yourself lots of energy in users > yourAccount > energy > save changes

  • make the modifications in hw sketch and upload. for easy switching between cloud and local server, i made like this:

in header file:

//#define CLOUD
#define LOCAL

in main file:

#ifdef CLOUD
const char* ssid = "router ssid";       // CLOUD
const char* pass = "router wifi pass";  // CLOUD
char auth[] = "cloud token";

#ifdef LOCAL
char ssid[] = "zero ssid";             // LOCAL
char pass[] = "zero wifi pass";        // LOCAL
char auth[] = "local token";

and in void setup:

#ifdef CLOUD
    Blynk.begin(auth, ssid, pass);  // CLOUD

#ifdef LOCAL
    Blynk.begin(auth, ssid, pass, IPAddress(zero ip here));  // LOCAL

this way, when switching the same hw between local or cloud, i just have to comment / uncomment the 2 lines in the header file.

at this point all the pi / ap / server / app / hw configuration is done. now, i can connect to my local blynk server and have a fully standalone, working system. (when uploading new sketch ota, i just connect with my laptop to the pi zero wifi, and select the wemos ip address in arduino ide)

now, i could even stop here, because theoretically all is set up. but i’m too lazy person, and i wanted to have other “gadgets” like:

1) reduced boot time / power consumption on pi

2) access my pi zero from my windoze laptop (this way i can renounce to the pi’s keyboard, mouse and display)

3) have internet connection on the pi, while still in ap mode (this is important, because i have to keep the os and blynk server up to date, etc)

my linux knowledge is ultra basic, to say at least. probably i could never figure out how to achieve all these functions, if one of my friends didn’t help me out. (luckily, that guy is a unix / linux guru. these specimens are really strange kind of people, but could be quite handy sometimes ;))

1) ok, actually i could do this alone, with some google:
in terminal type: sudo raspi-config (this is kind of a “bios” menu for the pi)
here one can find various basic os setting. i just have selected the “no gui on startup, with command line auto login” option, that’s all. this way i have much shorter boot up time, lower current consumption, lighter on ram, etc.

2) access pi from windoze pc:

  • first enable ssh on the pi:
    one can do this in gui:
    start menu > preferences > pi configuration > interfaces
    or in sudo raspi-config

  • after ssh is enabled, install putty portable on the windoze machine. connect to the pi hotspot, open putty and type the pi zero ip address. leave the other settings as is (port 22, ssh). you can also save the session for future use. (on my pc the putty text size was too small to read, i could set the size in window > appearance > font settings.)

also, if you wish to set up auto log in with putty, you can do like this:

  • create a shortcut for putty exe
  • edit in shortcut > properties > target > putty.exe -load my_server -l your_user_name -pw your_password
    (‘my_server’ is the saved session name)

if all is set, just press open. a terminal window will open, here you have to enter user (default rpi user is “pi”), and password (default is “raspberry”).
there you have a working command line, to interact with the pi zero! no dedicated keyboard, mouse, display are needed, you can mount now the mini server out of sight!

3) internet connection:
for my project i set up the pi to work in access point mode (wifi hotspot). so, there is no internet connection on it. if you wish to check for server updates, or install new app, it is not possible.
here is how to share your laptop’s ethernet connection with the pi:

on the windoze pc:

  • connect to the pi zero wifi

  • start putty and connect to the pi (log in, etc)

  • set the gateway to use static ip:
    edit the interfaces file: sudo nano /etc/network/interfaces
    add after netmask line these 2 lines:

  • gateway (the pi ip address)

  • dns-nameservers

  • it should look like this:

    iface wlan0 inet static

save the file and close editor: ctrl+x, y, enter

  • restart pi with: sudo reboot
  • after the pi has restarted connect to pi wifi, open network and sharing centre
  • click on the ethernet connection > properties > sharing tab > check the first tab, uncheck the second. click ok.
  • click on the pi zero wifi > properties > internet protocol version 4 > properties > confirm that use the following ip address is selected, then click advanced.
  • in ip settings tab at ip addresses click add. enter the pi zero ip address, except for the last value give 200 (like this: for subnet mask use
  • after you create the alias, click ok in each previous dialog box
  • reboot pi, after it has restarted connect to pi wifi
  • in putty terminal check the internet connection with:
    ping (if you see some ms times it is ok)
    ping (if you see some ms times it is ok)
  • now you can install mc file manager for example with sudo apt-get install mc
  • if you need to transfer files between you pc and pi zero, you can do it easily with winscp portable
  • !!! after you no longer need the internet on the pi, you should uncheck the box in: ethernet connection > properties > sharing tab > uncheck the first tab

After all said and done, disable the GUI on the Pi, saves power :wink:

if you mean this:

it is already done :slight_smile:
i’ve heard that it is also possible to turn off the hdmi port, it saves around 25ma, but it is a little risky…

Ow yes, missed that, awesome instructions, very complete!

thanks, i still learning linux, on very beginner level

Did you use the forever service for this or did you find a less bloated way?

initially we (one of my quite expert linux friend + me) tried to make it with init.d method, but after more than 1 hour unsuccessful trying, we gave up.

with the crontab it worked out of the box, and still work flawless since than.

1 Like

@wanek crontab seems fine, maybe it’s the client (in combination with the server) that requires the forever service.

i do not really understand. you mean if the client + server are on the same rpi?

Yes, the issue is the Blynk server takes quite a long time to start up so if you try to run the client from crontab and similar it will fail. “Forever service” is fine though.

ah, ok i see. but i do not have the client on the same hw. the client is a wemos.

Hope you don’t mind me posting this here @wanek but hopefully this thread can become a go to resource for Zero W.

@Dmitriy I messed up a new Zero W installation with the new login details for the admin panel. I didn’t want to use a initially so I went with the default credentials and this was fine.

I then added and new admin panel credentials, but no certs, and restarted the server.
The credentials were for one of my email accounts that didn’t yet have an account on the server. At this point the default credentials still gave me access to the admin panel.

I then added the account for the email address in and started the server again.

Now I can’t get in with Chrome unless I use incognito mode, probably some weird caching issue. Can’t login with Internet Explorer and that doesn’t have an cache for the url. Incognito is still taking the default access details and not the credentials I provided.

How do I gain access with the real credentials?

Are certs required for the admin panel to work?

What will happen if I delete the account from the server?

no problem, posts from @Costas quite rarely debase the level of a topic :wink:

1 Like

regarding the autostart, there was a bug in docs, this is why it not worked with the first method…

The better solution is to create a separate script in init.d folder, and run update-rc.d to include it at startup. There is an example startup script for Blynk I made somewhere around here. But for reference, here is another script:


# Provides:          mjpeg-stream
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: mjpeg-stream
# Description:       webcam stream from local network


COMMAND="/home/bastiaan/mjpg-streamer/mjpg_streamer -b -i '/home/bastiaan/mjpeg-streamer/' -o '/home/bastiaan/mpjeg-streamer/ -w ./www -c bastiaan:15Pir@@tjes'"

status() {
	echo "==== Status"

	if [ -f $PID ]
		echo "Pid file: $( cat $PID ) [$PID]"
		ps -ef | grep -v grep | grep $( cat $PID )
		echo "No Pid file"

start() {
	if [ -f $PID ]
		echo "Already started. PID: [$( cat $PID )]"
		echo "==== Starting"
		touch $PID
		if nohup $COMMAND >>$LOG 2>&1 &
			echo $! >$PID
			echo "Done"
			echo "$(date '+%Y-%m-%d %X'): START" >>$LOG
			echo "Error"
			/bin/rm $PID

kill_cmd() {
	SIGNAL=""; MSG="Killing "
	while true
		LIST=`ps -ef | grep -v grep | grep server.jar | awk '{print$1}'`
		if [ "$LIST" ]
			echo; echo " $MSG $LIST" ; echo
			echo $LIST | xargs kill $SIGNAL
			sleep 2
			SIGNAL="-9" ; MSG="Killing $SIGNAL"
			if [ -f $PID ]
				/bin/rm $PID
			echo; echo "All killed" ; echo

stop() {
    echo "==== Stop"

    if [ -f $PID ]
        if kill $( cat $PID )
        then echo "Done."
             echo "$(date '+%Y-%m-%d %X'): STOP" >>$LOG
        /bin/rm $PID
        echo "No pid file. Already stopped?"

case "$1" in
            stop ; echo "Sleeping..."; sleep 1 ;
            echo "Usage: $0 { start | stop | restart | status }"
            exit 1

exit 0

The trick is to use the start/stop/restart states otherwise update-rc.d won’t work. More info here: