Sunday, June 3, 2018

Raypak Pool Heater Repair

Let me start with a disclaimer, only attempt this if you are familiar with working with electricity and are somewhat handy.  Heater combines high voltage and gas, so lots of bad things can happen if you don't know what you are doing.

I have an old Raypak pool heater,  just turned 16 years old.  This is very old for a pool heater, so I was ready to buy a new one when I tried to turn it on, and it didn't work.  But I decided to see if I could fix it, and here's what I did to troubleshoot and fix.  Depending on what's wrong, this may or may not help you.

My problem was I was not getting a spark to start the pilot.  When the heater is working you hear a clicking noise when it fires up.  This is the spark which starts the pilot, which in turn lights the heating element.

I have a RP2100 heater, low nox version for Calif., actual model number is something like P-R335A.  The display failed one under warranty, and was going a 2nd time, so I setup it up for remote control so I could stop using the display.  The display is something like $300, so its not worth it to keep replacing, and seems to be a weak link in this heater.  Other than the display, its worked great until a couple weeks ago, when it would not fire up.

To troubleshoot, you need a volt meter to check to see if you have voltage where you need it.  I also used a soldering iron, and a couple of screwdrivers.

There are four screws that are on the sides of the front panel which contains the display.  This is the rectangular piece that is almost as wide as the heater, on the top of the front side of the heater.

I turned off 220V to the heater.  Make sures its off, my 220V also goes to my pump, so its easy to tell if 220V is off.  If not sure, turn off your main so all power is off.   Then you remove the screws and then you push up the front a bit, and it will pivot down.

When its down, you can see there is big piece of plastic covering a board that connects to the display, in the part that pivoted down.
On the front of the heater, there is a module and a bunch of wires.


On the module, it has a couple pins that say 24V.  I turned 220V back on, and turned my pump on, then measured power here at it read about 7 V.  Set the meter to AC Voltage.  So that's not good.  I thought the transformer that converts 220V to 24V may be back, or a bad connection, but it turned out I needed to measure somewhere else.

I traced 24V to see how it is wired.

220V comes into the side of the heater, and then it goes to a transformer that is under a cover on the far right side of the heater.  Unscrew two screws, and the cover will come off.  You need to carefully more the cover out of the way, there are a bunch of wires so it is kind of hard to move.  The transformer will be loose too, but the wires hold it in place.  220V goes straight to the transformer, and then a blue and yellow wire come out of transformer, this is the source of 24VAC, which provides the power for the heater.  220V is used for the fan motor and this transformer, but nothing else I could see.

Heres a picture, the white in the square hole is part of the transformer.  You can see the blue and yellow wires coming out of the hole.  The green wire is ground.


24VAC on the blue wire goes to a switch on the side of the heater, the on/off switch for the heater.  I never knew the heater had this switch, because its on the side of the heater against a wall so I never saw it lol.

Then the blue and yellow wires go into the top part of the heater, to the controller board.

Turn power off, you can use the switch on the side of the heater to turn off power if you like, its easier than turning off the 220V breaker.
If you remove two screws that hold down the black plastic cover, you will see the board.



On the left side of the picture above, you see the connector that brings 24VAC and ground to the controller board.  If you stick your meter probes in the connector, you should see about 24VAC.  My voltage was around 26VAC, it depends on what your 220V is, and mine is a little higher.

So 24VAC was going into the controller board, but I figured out it was not going out.  It goes from the controller board to the module I showed in the first picture.  The connector in the middle of the three side by side connectors goes to the module. The module is a Honeywell S8600H, and this module generates the spark for the pilot, so if it doesn't get power, no spark and no fire.

I traced power through the controller board.  To do this, I had to scrap off the conformal coat that protects the board.  Used an exacto to scrap some off, the a soldering iron the re-tin the pins and kind of melt the coating, so I could get a probe to the pins.



This pictures is from the back of the board.  I unscrewed four screws that hold the board in place, then removed all the connectors to get it out.  You may not need to do this, but its not that hard.  The one big connector, I used a flat head screwdrive to help pry it off, but be careful not to damage any parts are traces if you do this.

So power comes into the board in top left of pic.  Left pin is H (high but there really is not a high for AC, but this is from the blue wire that goes through the on /off switch).
L goes directly from the power input connector the the connector for the Honeywell module.  H goes to the first pin of the big connector.  All of the safety lockouts are wired to the big connector, and alternating pins are shorted together.  The black marks are in between pins that are shorted together.
So power goes into the left of the connector, and then goes through a bunch of safety sensors for things like water flow, and then comes out on the right side.

Then H goes to a relay.  The long black lines show how H is routed.  H should go through the relay, and then to the Honeywell connector.  But in my case, H was not getting through the relay.  I don't know if the signal was missing to turn on the relay, of the relay failed because of age and the elements.  So I soldered the wire you see across the relay, and now H makes it all the way through to the Honeywell connector.

After I added that wire, I connected everything back up, and now I see 26VAC at the honeywell connector.  And when I turned on the heater with my remote control, it fired up.

I had one other problem, I had changed my remote control to a diy setup this summer, using relays to control my pump and the heater.  So some reason, when the heater relay turned on, it turned off the pump relays, and the pump would stop, so the heater would stop too.

I decided to just short the heater control wires together.

It works now, I just have to use the on/off switch on the side to turn of and off the heater.
Since I only use the heater when the water is cold at the start of the season, this will work for me.

BTW, to control the heater, the orange/black wires go to one side of a relay, and the yellow black to the other side.  Close the relay to short the wires, and the heater turns on, as long as the heater is set for remote control.

Otherwise, I could probably put the heater control on a different relay, that is not connected to pump relays, although it should not matter.  I could also add a relay to control heater power, but I expect just using the switch will be fine.  I rarely use my the heater, but when I need it, its now working.





Water Heater repair

My water heater stopped making hot water, and was ready to replace it.

But I found the stuff that was taped to the heater, found it had a 12 year warranty and the date of Manufacture was about 8 years ago, so I called them.  It was a GE water heater, actually made by Rheem.

They had me check the pilot light, I could not see it through the little glass window.  After a few calls to troubleshoot it (had to clean the glass window), they sent me a new pilot light assembly.

It has a thermostat as part of it, so if the pilot goes out, no gas will be supplied for safety.  They provided the entire assembly, I replaced it lit.  After a hour or so, hot water again :)

Since the thermostat is in a very hostile environment, next to the burner, I think this is a common failure.  Other than I leaking tank, seems like one of the more likely things that could fail.

Monday, October 2, 2017

Bucket Subwoofer

Based on Ed's design here
Bucket Sub instructions

threads
Transcendent Sound


1. Peerless SLS 830667, 8" Paper Cone Woofer
2.  Binding posts (optional, but can also order from PE)

  1. 2. some silicone sealant
dow 738 or 732?

3. 3 feet, one inch in diameter and inch tall

4. 4 to 8 three inch deck screws

5. one 5 gallon bucket and lid

6. one bag of fast setting concrete.

7. three, 2 inch drywall or wood screws for the feet

8. maybe some small sheet metal or wood screws for the driver.....I did not screw it down on mine but it would not hurt.

I'm using a minidsp 2x4 as an electronic crossover to generate the sub signal, and a older Crown XLS-202 amp 

3.7.2 Bridge-Mono Mode Typical input and output wiring is shown in Figure 3.7. INPUTS: Use a custom “Y” adapter cable, wired to split the signal and invert the polarity for the Channel 2 amplifier input as shown in Figure 3.8. We recommend you label the ends of the Y adapter to help make sure to connect the correct end to each amplifier input. 

Connect the Y adapter between the signal source and each amplifier input. 

NOTE: Crown provides a reference of wiring pin assignments for commonly used connector types in the Crown Amplifier Application Guide (Section 1.21.) available at www.crownaudio. 

OUTPUTS: Connect the speaker across the red binding post of each channel. Do not use the black binding posts when the amp is being operated in Bridge-Mono mode. 

NOTE: The Channel 1 and 2 level controls MUST be set to identical settings when operating the XLS amplifier in Bridge-Mono mode




Building the sub
1. Turn bucket upside down and use driver to determine the size mounting hole. Cut hole in bottom of bucket. Test the fit.

2. Using 2 inch screws, screw the feet onto the lid and pound the lid on the bucket making sure it is all the way on, I used a rubber mallet. The cement should anchor the screws and feet

3. Between the lid and the the projection on the bucket drive the 3 inch deck screws in. They are the anchors for the cement. I used 4, use as many as you like.

4. Drill a small hole above the projection on the bucket for the wire to exit. Or install some binding posts if you want it "fancy".

5. Mix the concrete in another container....we don't want it on the inside walls, be neat here! Mix it thoroughly and not too runny! 

6. With bucket upside down, carefully pour/scoop cement through the driver hole and fill it just above the projection on the bucket making sure it covers the anchor screws, about 2 to 3 inches deep.

  1. 7.Let it cure at least 3 days.  The moisture is the concrete has to come out before the bucket is sealed.

  2. 8.Solder wire to driver, pass through hole or connect to binding posts and silicone the driver in place, use screws if you want but the silicone will hold it.
  3. You are supposed to turn the bucket upside down, make the hole for the driver, turn it over and pound the lid on, put the anchoring screws around the rim, screw the feet on with anchoring screws and fill it about 3 inches deep with fast setting concrete, wait at least 3 days , stick some binding posts on the side sealing them with silicone...................that is the enclosure!

    I use "co ax sealer" from Parts Express to seal the driver. Silicone is not good enough!

  4. If you do a good silicone, it'll work.  Something like Permatex will do the dance.  Avoid the caulk tubes.

9. Seal the wire hole with silicone

10. Hook her up and be amazed

  1. 11.Notice the lack of anything inside, don't screw it up with stuffing! 

Wednesday, August 9, 2017

Asus router

Asus router setup info
Stuff I setup on my Asus router
I have a tmobile tm ac1900
A rebadged Asus rt ac68u
DDNS through Asus so I could have a link where I could always access my pi through the router.
This is where Asus give you a link in the form of. Asus. Com and it constantly monitors your home Internet address which changes, so you can always connect

Select WAN on left, then DDNS on top.
Then just enter a host name, and apply.  If its available, you will get it.



VPN with openvpn on the router. This keeps it safe, all comm goes through VPN


Changes from default config
1.  Don't use the normal 192.168.1.x for the internal ip address.  Change 1 to something else.
Select LAN on the left.  Change the IP address, then select apply.
2.  enabled DDNS.  Select WAN on the left, then DDNS tab on top.  Yes to Enable the DDNS Client, I used the asuscomm.com free ddns server, created a new address.  It checks for availability.  Then click apply.  You don't have to worry about remembering the address, it will automatically insert the address into the openvpn file below.
3.  Turned on WPS (from wireless menu)
4.  Added pi as a static IP address
5.  Enabled guest network
6.  Turned on VPN Server using openvpn.  Used the default setting.  Create some usernames and passwords, add and save.  Export file.  Do the DDNS before doing this, and it will use the ddns address you created.  Export the file, should be client.ovpn
email the file to yourself

Android VPN setup
install open VPN connect on your phone.
go to your email, and download the client.ovpn file
start the open VPN connect program, and select the ovpn file.  It was in my downloads directory of the sd card.
enter your username and password
hit connect, wait a few, and it should connect.

You can now go to your browser, and connect to anything in your home network.
Address needs to be in the form of 192.168.xxx.xxx



Wednesday, January 18, 2017

Domoticz Configure

Open webpage by going to:
http://192.168.1.xxx:8080/#/Dashboard
replace xxx with the address of the Pi


It will say no favorite devices defined



Select Setup in upper right, then hardware

Select OpenZWaveUSB in Type

Give it a name, I used Zwave Stick Gen5, then select Add


It should show up on top of the screen.  If not, select Setup on top right, then Hardware.


Now select the blue setup box, and you will see whatever devices you have added to your zstick

Now select Setup on the top right, then Devices.



Click the green right pointing arrow
This will pop up

Enter a name, then Add Device

 Now if you select Switches on top (if you added a switch), you will see a box where you can control your switch

If you select the Star, it will turn yellow, and this will show up on your favorites screen.




Domoticz Installation



Instructions to install Domoticz and OpenZWave

This was a fresh install on a new RPi3.

Since I needed OpenZWave, I had to rebuild Domoticz



Installing from Source

Build times reported are when using a Raspberry Pi 3, using "make -j 3"
(Older revisions of the raspberry pi could take up to 10x longer to compile)
You also might need to install GCC 4.6 and compile with this version as 4.9 takes to much memory
Creating a large swap file does not solve the problem, and build with 'make -j 3'
If you are using an old version of the Raspberry Pi, remove the "-j 4" from the make commands!

sudo apt-get install cmake make gcc g++ libssl-dev git curl libcurl4-openssl-dev libusb-dev wiringpi

Now build and install the Boost library.
mkdir boost
cd boost
wget http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download
tar xvfz download
rm download
cd boost_1_60_0/
./bootstrap.sh
./b2 stage threading=multi link=static --with-thread --with-date_time --with-system --with-atomic --with-regex
sudo ./b2 install threading=multi link=static --with-thread --with-date_time --with-system --with-atomic --with-regex
cd ../../
rm -Rf boost/

Build Support for OpenZWave

If you need support for ZWave, you need to compile open-zwave before compiling domoticz Make sure to follow the below steps, you will end up with a folder layout like:
- open-zwave-read-only
- dev-domoticz
sudo apt-get install libudev-dev
For the first time, you need to clone the code (copy) from GitHub into your system:
git clone https://github.com/OpenZWave/open-zwave open-zwave-read-only
Refresh the source and Build OpenZWave(1m23.057s for initial build (rpi2 3 minutes))
cd open-zwave-read-only
git pull
make -j 3


go back to the top folder (your Home directory):
cd ..

Domoticz Source

For the first time, you need to checkout the source from GitHub onto your system:
git clone https://github.com/domoticz/domoticz.git dev-domoticz
Build Domoticz (21m15.899s on a raspberry pi 3 , 35m0.646s on a raspberry pi 2 for initial build)
If you have updated dev-domoticz, the make step will only re-build those files that have been changed - although if a header-file common to a lot of source files has been changed, this will still take a long time
Note building on pi 3 with image september jessy with gcc 4.9, you need bigger swapspace 512 instead of 100 (see this  or else it will take ages...


cd /etc/dphys-swapfile

CONF_SWAPFILE=512

free -m

Change to the Domoticz directory, and start building
cd dev-domoticz
cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt
make
The build failed with "make -j 3", so changed to "make" , and it worked with no errors
took about an hour on my pi3 to build

Make Domoticz startup at boot time (Also needed for Web Update)


cd /dev-domoticz
sudo cp domoticz.sh /etc/init.d
sudo chmod +x /etc/init.d/domoticz.sh
sudo update-rc.d domoticz.sh defaults
Edit the startup script and change the USERNAME, DAEMON and DAEMON_ARGS parameters to reflect your current settings
sudo nano /etc/init.d/domoticz.sh
Make sure the lines look like this:
USERNAME=USER
DAEMON=/home/$USERNAME/dev-domoticz/$NAME
DAEMON_ARGS="-daemon -www 8080"

if you are using the default user name, it should say:
USERNAME=pi
If you want to use another web interface port change:
DAEMON_ARGS="-daemon -www 8080"
Test Domoticz (Important to get the file ownerships right!)
cd ~/dev-domoticz
sudo ./domoticz
Start Domoticz
sudo service domoticz.sh start
Now connect with a browser to see if it is up and running.
You can now start/stop/restart domoticz with:
sudo /etc/init.d/domoticz.sh start to start Domoticz
sudo /etc/init.d/domoticz.sh stop to stop Domoticz
sudo /etc/init.d/domoticz.sh restart to restart Domoticz
sudo /etc/init.d/domoticz.sh status to check the status of Domoticz (running/not running)

Updating Domoticz

Binary install update

Use the Web Interface to update Domoticz (Setup->Check for Updates)
If this fails for any reason (e.g. partial download giving segmentation fault) then you should manually update by:
Stable:
sudo /etc/init.d/domoticz.sh stop
cd ~/dev-domoticz
./updaterelease
Beta:
./updaterelease
./updatebeta

Source Update

Login to your Raspberry Pi with the 'pi' user and issue:
cd domoticz
git pull
make -j 4


Install watchdog

sudo modprobe bcm2708_wdog
echo "bcm2708_wdog" | sudo tee -a /etc/modules

Install the software watchdog daemon

sudo apt-get install watchdog
sudo update-rc.d watchdog defaults

Configure the watchdog daemon

Open /etc/watchdog.conf with your favorite editor (mine is nano).
sudo nano /etc/watchdog.conf
Uncomment the line that starts with #watchdog-device by removing the hash (#) to enable the watchdog daemon to use the watchdog device. Uncomment the line that says #max-load-1 = 24 by removing the hash symbol to reboot the device if the load goes over 24 over 1 minute. A load of 25 of one minute means that you would have needed 25 Raspberry Pis to complete that task in 1 minute. You may tweak this value to your liking.
If you only want to setup the watchdog to restart in case your system hangs, continue to the section Start the watchdog daemon

Use watchdog to check Domoticz

This script relies on the fact that the Domoticz.log is written in /tmp/ newer installs have this option disabled by default. To make this script work you must enable the logfile.
sudo nano /etc/init.d/domoticz.sh
and change the line OPTIONS="-www 8080" to:
OPTIONS="-www 8080 -loglevel=1 -log /tmp/domoticz.log"
(* Alternative ) In my case, the option must be set up like this
DAEMON_ARGS="$DAEMON_ARGS -www 8080 -loglevel=1"
DAEMON_ARGS="$DAEMON_ARGS -sslwww 443"
DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.log"

Setup mailer:
sudo apt-get install sendmail-bin
sudo apt-get install mutt
If mutt does not install, then try updating your pi first by running:
sudo apt-get update
Then continue to:
cd /home/pi
create the file .muttrc with the following content: (vi .muttrc or nano .muttrc)
# basic .muttrc for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "username@gmail.com"
set imap_pass = ""
set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = ""
set from = "username@gmail.com"
set realname = "Firstname Lastname"
#
# # Change the following line to a different editor you prefer.
set editor = 'vim + -c "set textwidth=72" -c "set wrap"'
# Basic config
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed=yes
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
set pager_index_lines = 10
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
alternative_order text/plain text/html *
auto_view text/html
bind editor <Tab> complete-query
bind editor ^T complete
bind editor <space> noop
# # Gmail-style keyboard shortcuts
macro index,pager am "<enter-command>unset trash\n <delete-message>" "Gmail archive message" # different from Gmail, but wanted to keep "y" to show folders.
macro index,pager d "<enter-command>set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n <delete-message>" "Gmail delete message"
macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox"
macro index,pager ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail"
macro index,pager gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages"
macro index,pager gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"
macro index,pager gl "<change-folder>?" "Go to 'Label'" # will take you to a list of all your Labels (similar to viewing folders).
edit the first lines to setup your gmail account info
Create a mail script in /home/pi:
cd /home/pi/
sudo nano mailIP
Paste the following (repalce YOURMAIL with full email address of where you want the email sent i.e. fred@hotmail.com):
 #!/bin/sh
 mailreciever=YOURMAIL
 today=$(date)
 #my_ip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}'`
 my_ip=`wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'`
 my_pi="Domoticz RaspberryPi has rebooted! "
 message="Your Pi has rebooted at $today. Current IP address = $my_ip"
 echo $message > message.txt
 mutt -s "${my_pi}" ${mailreciever} < message.txt
The commented line fetches the internal ip, example fetches external ip.
Make sure the mailIP can be executed:
sudo chmod +x mailIP
Test the script by running it:
./mailIP
Setup rc.local to send the mail at each reboot: Edit /etc/rc.local:
sudo nano /etc/rc.local
Add this above the exit 0 line:
sudo /home/pi/mailIP & 
Make sure the rc.local can be executed:
sudo chmod 0755 /etc/rc.local
sudo bash
cp /home/pi/.muttrc /root


sudo nano /etc/watchdog.conf
Uncomment the lines file and change and set them to:
file                    = /tmp/domoticz.log
change                  = 300
This setting will restart the pi when domoticz.log hasn't been updated in 5 minutes, the time is in seconds (tested).
Be sure to remember this when stopping the domoticz service by hand!
and for new system , that do nothing yet, you can prevent unwanted reboot by adding a script like this :
cd /home/pi/domoticz/scripts/lua
nano script_time_domotizAlive.lua
commandArray = {}
print('Domoticz alive !')
return commandArray
It will update the log every minute.

Start the watchdog daemon



sudo service watchdog start

















Thursday, April 7, 2016

Secure access to Pi part 1


reference


Creating a new user

As mentioned, it's a good idea to get rid of the default 'pi' user just to make it harder for anyone who might try to hack you (and there are automated methods that might find you and try it, especially as the Pi itself becomes more popular and the default account details remain the same for each one).
Going into detail on how Linux controls access rights and permissions for users is beyond the scope of this article, but suffice to say it has a concept of "users" and "groups" – users can belong to any number of groups, and groups are used to control permissions and access to files, directories, etc. It's through this system that Linux machines are administered. We want to get a list of groups that the default Pi user belongs to, so that we can create a new user which belongs to all the same groups – and therefor can do everything that the default Pi user can do. Belonging to all the same groups as the 'pi' user is not strictly necessary (and can be a bad idea if you're determined to be as secure as possible), but it can be useful if you want do other stuff with your Pi later. It also keeps this post simpler because being more restrictive would require more knowledge of Linux administration. You can figure that out later if you feel you want to. In the Bash prompt type:
groups
You will see a list output similar to the one below – yours may be different to mine (this article will become old and out of date) so pay attention to your list and not mine!
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi
Now we can create a new user. Type the following into the command prompt but remember to use your list of groups (minus the first 'pi' item) and replace USERNAME with the username you want to create. Make sure you type it all on one line (if you're seeing the line wrap here that's just to make things readable for you).
sudo useradd -m -G  adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi USERNAME
Next we set a password for the new user:
sudo passwd USERNAME
Complete the prompts as they appear. 

Deleting the default 'pi' user

N
Next you need to add the newuser to the "sudoers" file
CODE: SELECT ALL
sudo visudo
Scroll down to the bottom and duplicate the "pi" entry for the new user. Leave the "pi" entry for now.

Next edit the autologin for the desktop, and replace "pi" with the new user.

CODE: SELECT ALL
sudo nano /etc/lightdm/lightdm.conf

Scroll down to the bottom of the file and change the "autologin-user=pi" to the new user. Save and exit.

Now edit the "autologin@.service" file, that where the "pi" processes are coming from, and change it to the new user.
CODE: SELECT ALL
sudo nano /etc/systemd/system/autologin@.service
Scroll down to the line
CODE: SELECT ALL
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
and change the autologin to the new user, save and exit.

Sudo reboot

The Pi will turn itself off. Un-plug the power, plug in the network cable, then plug the power back in. The Pi will boot up and leave you in a Bash shell asking for a login name: Log-in with your newly created user's details (i.e., don't log in as 'pi').

Type:
sudo deluser --remove-all-files pi
There will be a bunch of stuff it couldn't do, but at the end it should say
Removing user `pi' ...
Warning: group `pi' has no more members.

Done.

OK, now you've deleted pi, you can go setup things with your new, safer, username.

Optional step: Setting up Fail2Ban

This application helps to prevent hacking attempts by detecting log-in attempts that use a dictionary attack and banning the offending IP address for a short while. NOTE: If you're using SSH Key Pairs and have disabled SSH Password Authentication then you may not want to bother with this as no-one can hack their way in via a dictionary attack anyway.
sudo apt-get install fail2ban
Wait for this to complete; it should be fine running the default set up so you can stop there, or learn more about customising fail2ban.