HOWTO - Make a BrewPi Fermentation Controller For Cheap

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Status
Not open for further replies.
Anyone know of an elegant way to add an outlet inside of an enclosure? I'm building my enclosure and I want to be able to plug the 9v wall wart within the enclosure. I could easily splice in the cut off end of an extension cord to the incoming power, but I'm looking for something a bit more polished.

If you are using din rails you can get din rail outlets.
 
If you are using din rails you can get din rail outlets.

I'm not using DIN rails. Just wiring it up the way in the diagram on the first post. But I'm using mini xlr connectors for the probes and outlets mounted to the outside of the enclosure for a clean look, so I thought it would be good to have a nice install for an internal outlet.
 
fwiw, my BrewPi minions have internally located 9V/1A wall-wart boards stripped of the plastic shell and hard-wired to the AC feed. Very compact solution...

Cheers!
 
I don't know anything about your build, so, no.



If you leave pin 16 grounded and simply control pin 15 between 0 and ~4.something volts, the backlight will be off or on. If your LCD doesn't work that way, provide the part number and maybe I'll look up the spec for it...

Cheers!

Hello, I bought this LCD:
http://www.aliexpress.com/item/Free...lue-screen-blacklight-LCD2004/1893875464.html

I hooked it up like this:
attachment.php


But now that I know that the light should go out after 10 minutes, I would already be very happy with that sollution. The switch I tried on pin 16 and 15 and it did not give me a good result.

But I don't know what I did differently that mine won't dim after 10 minutes. Will this be something wrong in the harwire/wireing of the display or the hex file on the arduino?

Thanks for the help so far.
 
Hello, I bought this LCD:
http://www.aliexpress.com/item/Free...lue-screen-blacklight-LCD2004/1893875464.html

I hooked it up like this:
attachment.php


But now that I know that the light should go out after 10 minutes, I would already be very happy with that sollution. The switch I tried on pin 16 and 15 and it did not give me a good result.

But I don't know what I did differently that mine won't dim after 10 minutes. Will this be something wrong in the harwire/wireing of the display or the hex file on the arduino?

Thanks for the help so far.

Hi there,

The reason it is not behaving as you expect is because you don't seem to have anything in your circuit to turn the backlight on and off.

The backlight is basically an LED connected to pin 15 and 16, and is independent of the operation of the LCD module itself. Pin 15 is the LED supply, and pin 16 is ground. In your diagram you show that pin 15 is connected directly to the positive power line, so it will get power all the time.

To turn the backlight off you could pull the wire to pin 15 out of the breadboard, but in your diagram this also goes to pin 2, which is the power supply for the LCD module, so you can't do that. I suggest you get a second wire, so there are two wires from the positive supply line to the module. One to pin 2 (for power) and one to pin 15 (for the backlight). Then, you can disconnect one wire to turn off the backlight without affecting the rest of the module. You can put a switch there if you like, which might be an acceptable solution.

If you want BrewPi to control the backlight then you need some more components. In this diagram (which was posted on the previous page) you can see an FET option and a transistor option (lower right of centre):
https://www.homebrewtalk.com/showpost.php?p=7358921&postcount=4676

You can see the FET or transistor is controlled by pin 2 of the 74HC595 chip. Right now, BrewPi is controlling pin 2 to turn the backlight on and off, but there is nothing in your circuit to make use of that signal. It looks to me that the transistor option is easiest (just a 2N2906 transistor and a 200 ohm resistor), so you could try hooking that up on your breadboard. The transistor is not critical and there are many equivalent ones that you could use. Google for equivalents, or ask. You might already have something suitable in your junk box.

Hope this helps.
 
Hello, thank you for the reply!

I'm sure I have a transistor laying around somewhere. I will try to understand the schematics to connect it all up (I'm not that good when it comes to electrical diagrams). I used the graphical drawing above to hook everything up to a small PDB I ordered. If I don't succeed I go for the switch option again.

But it is strange, I did cut the pin 15 wire before and the light went of, but it came back on in a slow stroboscope behavior (once every 2 seconds). But like you said, cutting that wire also cut the connection to pin 2 on the LCD (which might explain the scrambling issue I had when powering up again).

I already build in a switch in my unit which is unused at this moment, so maybe I'm going for the switch option once more and do some extra testing. If it does not work, I'll check the transitor option.

But now I'm not going to touch it since it's fermenting my saison beer :) I'll be back in a few weeks to implement this :)
 
Thanks, I will check this once my current brew is finished :) I hope to make it work with a simple on/off switch, I do not really need the timer function to be honest :)

By the way, I was looking on the Brewpi webshop. That Brewpi photon V2, does it have allot of interessting functionalities that our DIY solutions don't have? I already noticed that the updates for the Brewpi arduino version are no longer supported since that Photon thing came on (understandable). Apart from the fancy display, are there things we are missing out on?
 
I don't see why you couldn't put a simple switch between vcc and pin 15. It's worth a try.
 
Hi all, any reason why my Room Temp sensor doesn't change temp as smoothly as the other two??

As you can see from the two segments of the graph, the room temp line is fuzzier than the other two due to the large number of rapid changes of temp +/-01.c . . . This is shown more clearly in the second enlarged bit.

I'm puzzled I put it down to the fact that the RT sensor attaches to the box with the Pi and 'duino in, and the other two connect to a junction box inside the fridge . . .but those graphs are from today where I've brought it inside the house.

Will swap sensors around and see what that does

Brewpi.spikes1.PNG


Brewpi.spikes2.PNG
 
Hello, thank you for the reply!

I'm sure I have a transistor laying around somewhere. I will try to understand the schematics to connect it all up (I'm not that good when it comes to electrical diagrams). I used the graphical drawing above to hook everything up to a small PDB I ordered. If I don't succeed I go for the switch option again.

But it is strange, I did cut the pin 15 wire before and the light went of, but it came back on in a slow stroboscope behavior (once every 2 seconds). But like you said, cutting that wire also cut the connection to pin 2 on the LCD (which might explain the scrambling issue I had when powering up again).

I already build in a switch in my unit which is unused at this moment, so maybe I'm going for the switch option once more and do some extra testing. If it does not work, I'll check the transitor option.

But now I'm not going to touch it since it's fermenting my saison beer :) I'll be back in a few weeks to implement this :)


It was strobing because when you pulled power from pin 15 it was also turning off the lcd. but if there was still a jumper to pin 2, then everytime the shift register pushed a new line of characters or a reset it would be back feeding voltage over the ground through the backlight. you will have to separate the power for the lcd from the backlight power no matter what road you take if you decide to wire it up to go out.
 
Hi all, any reason why my Room Temp sensor doesn't change temp as smoothly as the other two??



As you can see from the two segments of the graph, the room temp line is fuzzier than the other two due to the large number of rapid changes of temp +/-01.c . . . This is shown more clearly in the second enlarged bit.



I'm puzzled I put it down to the fact that the RT sensor attaches to the box with the Pi and 'duino in, and the other two connect to a junction box inside the fridge . . .but those graphs are from today where I've brought it inside the house.



Will swap sensors around and see what that does


Yes, it's been discussed many times. the room temperature sensor is basically worthless. bit has no impact on your pid algorithm and it's only there for reference (say you can't figure out why you had a temp spike, you can see that it was atmospheric because the room itself spiked or dropped). other than that it would be a waste of code to increase the resolution of that probe. so it was done intentionally.
 
Simple switch it is then :) once my brew finishes I'll re-wire it.

I just bought myself an Iwatch and I instantly thought: wouldn't it be awesome to have a widget on the screen showing the exact temperature of the beer all the time? :p that would be so awesome ^^
 
It was strobing because when you pulled power from pin 15 it was also turning off the lcd. but if there was still a jumper to pin 2, then everytime the shift register pushed a new line of characters or a reset it would be back feeding voltage over the ground through the backlight. you will have to separate the power for the lcd from the backlight power no matter what road you take if you decide to wire it up to go out.


Room air has random air currents. Someone walks past, the air is disrupted and the temperature around the probe changes. Air isn't a homogenous temperature. In a chamber these currents are reduced, but even then there can be stratification.

Adding to that is the scale of the graph. A change of half a degree can cause a spike which looks dramatic but isn't.
 
Hi all, any reason why my Room Temp sensor doesn't change temp as smoothly as the other two??



As you can see from the two segments of the graph, the room temp line is fuzzier than the other two due to the large number of rapid changes of temp +/-01.c . . . This is shown more clearly in the second enlarged bit.



I'm puzzled I put it down to the fact that the RT sensor attaches to the box with the Pi and 'duino in, and the other two connect to a junction box inside the fridge . . .but those graphs are from today where I've brought it inside the house.



Will swap sensors around and see what that does



Room air has random air currents. Someone walks past, the air is disrupted and the temperature around the probe changes. Air isn't a homogenous temperature. In a chamber these currents are reduced, but even then there can be stratification.

Adding to that is the scale of the graph. A change of half a degree can cause a spike which looks dramatic but isn't.

I have my unit testing until I get a box. Fridge and chamber probe are in air. The graph is spiky and bumpy.
 
Hi all, any reason why my Room Temp sensor doesn't change temp as smoothly as the other two??

As you can see from the two segments of the graph, the room temp line is fuzzier than the other two due to the large number of rapid changes of temp +/-01.c . . . This is shown more clearly in the second enlarged bit.

I'm puzzled I put it down to the fact that the RT sensor attaches to the box with the Pi and 'duino in, and the other two connect to a junction box inside the fridge . . .but those graphs are from today where I've brought it inside the house.

Will swap sensors around and see what that does

It's because the beer and fridge temperature graphs show filtered data, but the room graph shows unfiltered data.
 
It's because the beer and fridge temperature graphs show filtered data, but the room graph shows unfiltered data.

Thanks guys, makes complete sense to me now . . . I fixed all three sensors together with elastic bands last night and it all sort of calmed down.

I think I'll RDWAHAHB !

Just need to sort out the video streaming now :(
 
If you didn't (or can't) read the whole thread you should at least start at Post #4363. There is some good information thereafter regarding the legacy version.


That sorted it, thanks. Bit of an effort compared to the automated install but I've taken an image of SD card so should be easy to return to this point
 
Received some of my parts, read through a ton of the thread, ready to start bashing this stuff together. Two questions for Day_Tripper or anyone who has a RaspberryPints instance running.

First, I see many mentions by Day_Tripper that the index.php needs to be renamed on the brewpi install because I already have the RaspberryPints index.php. How do I do that and at what part of the install?

Second, there was mention not to run the rm command on I think the /var/www directory because it would wipe out my pints files. How do I avoid this in the install?

Thanks! Sorry for the noobie linux questions.
 
Yea as others have said, the Room temp is more just a nice to have and is accurate but its not smoothed out at all. WIth how the resolution of the DS18B20 probes you dont want jumpy data to be screwing up your PID algorithm so the others do some pre/post processing to the numbers.
 
[...]Two questions for Day_Tripper or anyone who has a RaspberryPints instance running.

First, I see many mentions by Day_Tripper that the index.php needs to be renamed on the brewpi install because I already have the RaspberryPints index.php. How do I do that and at what part of the install?

Second, there was mention not to run the rm command on I think the /var/www directory because it would wipe out my pints files. How do I avoid this in the install?

Thanks! Sorry for the noobie linux questions.

Both questions relate to the same issue: the RaspberryPints file structure is rooted in /var/www by default, thus that is where its index.php lives.

Done automagically or manually, the BrewPi installation will issue a 'rm -R /var/www' command that will wipe out EVERYTHING rooted at /var/www.
Gone, baby, gone. So it should be evident why you don't want that to happen.

If you rename index.php to something like rpints.php, don't do the rm command, and install the BrewPi web gui support to /var/www, you won't lose anything. BrewPi will put ITS index.php in /var/www (having renamed the R'Pints file first, it doesn't get overwritten); there are no other file conflicts between the two applications.

The Brewpi gui would then be accessed by default (eg: using simply http://192.168.1.40 will send your browser to the BrewPi page) and you can access RaspberryPints by pointing to its (renamed) php file in the url (eg: http://192.168.1.40/rpints.php).

Or, after you get BrewPi running, you could rename the BrewPi index.php to brewpi.php, put the RaspberryPints file back to index.php, and access the latter with just the host IP address (http://192.168.1.40) and the former with its php file name appended (http://192.168.1.40/brewpi.php).

Or you can avoid the whole conflict to begin with and install BrewPi to a folder under /var/www (eg: /var/www/brewpi). This is what I do, because it makes multiple-instance configurations easy as pie, with each instance having its own root folder under /var/www (eg: /brewpi1, /brewpi2...to /brewpi4).
Note that you still have to avoid running that 'rm' command!

I do the same with the other BrewPi file tree which lives somewhere under /home. Instead of using the default /home/brewpi for that structure, I use /home/brewpi/brewp1, /home/brewpi/brewp2...to /home/brewpi/brewpi4.

You do have to include the full path to each index.php file, but that's what shortcuts are for ;)

hth

Cheers!
 
So just FYI for those that care, this weekend my brew will be done and i'll be wiping my setup and starting from scratch(software wise) to update the documentation on the DIYBrewPi Wiki
Will you be basing the install on Raspbian Jessie, Jessie Lite, or Wheezy? I have to do the same thing at some point soon, and I want to end up with the latest Raspbian (Jessie Lite should work) and 0.2.11 BrewPi (scripts + Arduino firmware). If there are any gotchas then I'd like to know.

Cheers.
 
So just FYI for those that care, this weekend my brew will be done and i'll be wiping my setup and starting from scratch(software wise) to update the documentation on the DIYBrewPi Wiki

Awesome, awesome, awesome. I would happily be your noobie, least common denominator tester when you get it finished. I was going to start my stuff tomorrow but I can wait until next week to use your instructions.
 
Has anyone successfully used a Beaglebone Black for this? I got one on clearance from RadioShack. Maybe I'm being overly ambitious (as per usual), but I'm building my kegerator, which is a side-by-side fridge, and have hopes of having rpints on a vertical monitor on the freezer/tap side and a horizontal monitor running MAME arcade on the left.

I don't know if I'll have better luck buying a pi for the arcade and using the Beaglebone for the rpints/brewpi or visa versa.
 
Both questions relate to the same issue: the RaspberryPints file structure is rooted in /var/www by default, thus that is where its index.php lives...

hth

Cheers!

This totally helps. Thanks a ton.

A new question for the smart guys. I've had the RaspberryPints running successfully since v1, upgraded to v2 with the flow meters on the day it was released, and it has been running perfectly ever since. Guess who has two thumbs and hadn't made an image of his SD card during that entire time? You guessed it, this guy!

Well, I decided to create an image last night before I started with my BrewPi install. I imaged the card on my laptop then put it back into the Pi and the card was corrupted. I couldn't format it, I couldn't do anything. The card was a 16 gb card.

I figured there was no way that the card was imaged correctly and then coincidentally corrupted after, so I just figured I have to do a full reinstall. I bought two new cards today so I'd have one and a backup. I bought 8gb cards because they were cheap.

Tonight before starting the full reinstall, on a whim, I stole the wife's 16gb card from her camera and copied the image to it and incredibly the Pi started up and Pints picked up where it left off, including the last pour before the card fiasco.

So, way too long story short, I have an image of a 16 gb card that works. Is there any way to get this running on my 8 gb card so I can give the wife back her 16 gb card?
 
Has anyone successfully used a Beaglebone Black for this? I got one on clearance from RadioShack. Maybe I'm being overly ambitious (as per usual), but I'm building my kegerator, which is a side-by-side fridge, and have hopes of having rpints on a vertical monitor on the freezer/tap side and a horizontal monitor running MAME arcade on the left.

I don't know if I'll have better luck buying a pi for the arcade and using the Beaglebone for the rpints/brewpi or visa versa.
The BrewPi system has three distinct parts. There is the controller code, which runs on an Arduino (or now Spark), there is the logger/interface, which is a Python script that talks to the controller over a serial link, and there is the web app, which runs under the web server, and talks to the logger via a socket.

It is possible to run the logger and the web app on any Linux box (based on what I have gleaned from the web) so it ought to be possible to run it on a Beaglebone (since it's just another Linux box).

Google doesn't really show that anyone has done this, so you might be on your own.
 
If your installation didn't actually use more than half of that 16GB SD card, and you have a USB card reader that you can plug into your RPi, then there is a way to clone your 16GB card to the 8GB card.

Check out this page http://sysmatt.blogspot.com/2014/08/backup-restore-customize-and-clone-your.html

It takes awhile to do, but the procedure totally works - I've used it often.
You'll definitely want to save that link.

Note that before embarking on the above, one should stop any BrewPi scripts through the gui, stop the flowmon service for RaspberryPints ('$sudo /etc/init.d/flowmon stop') if installed, and generally stop any "live" applications (like web cams that record on movement, etc) to avoid issues with file locking.

Cheers!
 
[...]Google doesn't really show that anyone has done this, so you might be on your own.

There are 4700+ posts on this thread alone, and most of those are either folks needing assistances or folks providing assistance.

That might advise folks not to put themselves on an island...

Cheers! ;)
 
The BrewPi system has three distinct parts. There is the controller code, which runs on an Arduino (or now Spark), there is the logger/interface, which is a Python script that talks to the controller over a serial link, and there is the web app, which runs under the web server, and talks to the logger via a socket.

It is possible to run the logger and the web app on any Linux box (based on what I have gleaned from the web) so it ought to be possible to run it on a Beaglebone (since it's just another Linux box).

Google doesn't really show that anyone has done this, so you might be on your own.

Yeah, I've searched for a couple days now without finding anything. Bummer. I'll have to work at it and see where I get before giving up and getting another pi.
 
Yeah, I've searched for a couple days now without finding anything. Bummer. I'll have to work at it and see where I get before giving up and getting another pi.
Well, on the one hand, you can't have too many Pis. On the other, how hard can it be...
 
If your installation didn't actually use more than half of that 16GB SD card, and you have a USB card reader that you can plug into your RPi, then there is a way to clone your 16GB card to the 8GB card.

Check out this page http://sysmatt.blogspot.com/2014/08/backup-restore-customize-and-clone-your.html

It takes awhile to do, but the procedure totally works - I've used it often.
You'll definitely want to save that link.

Note that before embarking on the above, one should stop any BrewPi scripts through the gui, stop the flowmon service for RaspberryPints ('$sudo /etc/init.d/flowmon stop') if installed, and generally stop any "live" applications (like web cams that record on movement, etc) to avoid issues with file locking.

Cheers!

You rock. Thanks. Now to borrow an sd card reader from someone...
 
Having a problem getting the script to run
I've done many of the updates suggested to no avail

When I run if config command in the text it says

WLAN 100567 kb transmitted 0 errors 60432 dropped 0 skipped

Is this telling me that when I downloaded the program that it missed a whole bunch of info?

If so that would explain a lot
 
Note that before embarking on the above, one should stop any BrewPi scripts through the gui, stop the flowmon service for RaspberryPints ('$sudo /etc/init.d/flowmon stop') if installed, and generally stop any "live" applications (like web cams that record on movement, etc) to avoid issues with file locking.

Cheers!

As I'm sitting here for the last hour watching my files get copied, it dawned on me...is the motion detector one of the services I should have stopped? Palm hits forehead.

How do I stop it, besides commenting it out in the autostart file and rebooting?

Could this be why I got "kernel in use" errors when running the sd card partitioning scripts?
 
You're fine, the motion detector doesn't write any files, it just pokes at functions, so file locking is a non-issue.

I've appended one of my stream-of-consciousness tomes covering the cloning process.
There's all kinds of messages included so you can see what to expect along the way (including those kernel messages you mentioned - they're normal).
It's kinda huge so apologies to others.

[edit] I should note how I came about the linked site that drove the procedure below: let's say your Pi fleet was built using 8GB uSD cards, and you have an extra card. SD cards have varying real capacities as flash chips are hardly ever perfect and the factory initialization accounts for defects by reducing the usable size. So it's pretty darned rare to have even two SD cards with exactly the same capacity, never mind a fleet of them.

One day I decided to use win32diskimager to create a cloned SD card from an image, but the program flat out refused because the target card was 64KB lower capacity than the source card. And in fact when I checked all of my SD cards, the spare one had the lowest real capacity, so I couldn't clone it from an image. Hence having to do a live-image clone was the only way to find joy, and fortunately, Matthew E Hoskins had a nicely documented procedure out there for the using...


Code:
HOW TO CLONE SD CARD

Created backup image to obelisk e:

Create new SD card from live image:

pi$ sudo su
root# apt-get install dosfstools
root# apt-get install rsync

Stop Motion Service and disconnect camera

$ motionstop

Plugged in USB2 SOHOUSB reader

root# dmesg

[10346.000962] usb 1-1.2.2: new high-speed USB device number 10 using dwc_otg
[10346.105028] usb 1-1.2.2: New USB device found, idVendor=05e3, idProduct=0716
[10346.105065] usb 1-1.2.2: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[10346.105081] usb 1-1.2.2: Product: USB Storage
[10346.105096] usb 1-1.2.2: SerialNumber: 000000009740
[10346.112454] usb-storage 1-1.2.2:1.0: USB Mass Storage device detected
[10346.116135] scsi0 : usb-storage 1-1.2.2:1.0
[10347.112586] scsi 0:0:0:0: Direct-Access     Generic  STORAGE DEVICE-6 9740 PQ: 0 ANSI: 0
[10347.120131] sd 0:0:0:0: [sda] Attached SCSI removable disk
[10347.123249] scsi 0:0:0:1: Direct-Access     Generic  STORAGE DEVICE-6 9740 PQ: 0 ANSI: 0
[10347.126441] sd 0:0:0:1: [sdb] Attached SCSI removable disk
[10347.129775] scsi 0:0:0:2: Direct-Access     Generic  STORAGE DEVICE-6 9740 PQ: 0 ANSI: 0
[10347.138187] sd 0:0:0:2: [sdc] Attached SCSI removable disk
[10347.139607] scsi 0:0:0:3: Direct-Access     Generic  STORAGE DEVICE-6 9740 PQ: 0 ANSI: 0
[10347.152948] sd 0:0:0:3: [sdd] Attached SCSI removable disk
[10347.153733] scsi 0:0:0:4: Direct-Access     Generic  STORAGE DEVICE-6 9740 PQ: 0 ANSI: 0
[10347.162079] sd 0:0:0:4: [sde] Attached SCSI removable disk
[10347.455181] sd 0:0:0:0: Attached scsi generic sg0 type 0
[10347.456126] sd 0:0:0:1: Attached scsi generic sg1 type 0
[10347.457169] sd 0:0:0:2: Attached scsi generic sg2 type 0
[10347.458213] sd 0:0:0:3: Attached scsi generic sg3 type 0
[10347.459125] sd 0:0:0:4: Attached scsi generic sg4 type 0
[10355.503741] bcm2835_audio_set_ctls:558  Controls set for stream 0
[10364.234904] sd 0:0:0:2: [sdc] 30703616 512-byte logical blocks: (15.7 GB/14.6 GiB)
[10364.237255] sd 0:0:0:2: [sdc] No Caching mode page found
[10364.237292] sd 0:0:0:2: [sdc] Assuming drive cache: write through
[10364.251476] sd 0:0:0:2: [sdc] No Caching mode page found
[10364.251516] sd 0:0:0:2: [sdc] Assuming drive cache: write through
[10364.253192]  sdc: sdc1
[10365.962691] bcm2835_audio_set_ctls:558  Controls set for stream 0
root@rpints:/home/pi#


So new SD card is SDC: SDC1

First, we need to create the two partitions to hold our /boot and / (slash) filesystems. 
We do this with the GNU parted utility.

root@rpints:/home/pi# parted /dev/sdc

GNU Parted 2.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel msdos

Warning: Partition(s) on /dev/sdc are being used.
Ignore/Cancel? I
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No?
Y
Error: Partition(s) 1 on /dev/sdc have been written, but we have been unable to inform the kernel of the change, probably because
it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? I
(parted)  quit

Restarted system

root@rpints:/home/pi# parted /dev/sdc
GNU Parted 2.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart primary fat16 1MiB 64MB
(parted) mkpart primary ext4 64MB -1s
(parted) print
Model: Generic STORAGE DEVICE-6 (scsi)
Disk /dev/sdc: 15.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  64.0MB  62.9MB  primary               lba
 2      64.0MB  15.7GB  15.7GB  primary

(parted) quit
Information: You may need to update /etc/fstab.

Next format the two partitions

root@rpints:/home/pi# mkfs.vfat /dev/sdc1
mkfs.fat 3.0.26 (2014-03-07)

root@rpints:/home/pi# mkfs.ext4 -j /dev/sdc2
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
956592 inodes, 3822336 blocks
191116 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3917479936
117 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

root@rpints:/home/pi# 

Stop mysql server:

root@rpints:/home/pi# service mysql stop (start, restart)  


Now we need to mount these two partitions somewhere so we can copy data to it. 
Let's make a temporary directory under /tmp/newpi and do all our work under it. 
Below are the commands to mount our SD cards:


root@rpints: /home/pi# mkdir /tmp/newpi
root@rpints: mount /dev/sdc2 /tmp/newpi
root@rpints: mkdir /tmp/newpi/boot 
root@rpints: mount /dev/sdc1 /tmp/newpi/boot
root@rpints: df -h

Filesystem      Size  Used Avail Use% Mounted on
rootfs           13G  3.6G  8.8G  30% /
/dev/root        13G  3.6G  8.8G  30% /
devtmpfs        215M     0  215M   0% /dev
tmpfs            44M  320K   44M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            88M     0   88M   0% /run/shm
/dev/mmcblk0p5   60M  9.6M   50M  17% /boot
/dev/mmcblk0p3   27M  397K   25M   2% /media/SETTINGS
/dev/sdc2        15G   37M   14G   1% /tmp/newpi
/dev/sdc1        60M     0   60M   0% /tmp/newpi/boot

root@rpints:/home/pi# 

The output of the "df" command will show us that both slash and boot have been mounted and are the expected sizes. 


Next, we will execute a command to copy our existing raspbian OS installed on our running pi into our mounted SD card. 

Now, a couple notes about live cloning. 
If you are running any services that keep data files open (like mysql, postgresql, apt-get, or other applications) these should be shutdown to insure you get a clean copy. 

We will use the rsync utility for this copy, we will tell it to only copy / (slash) and /boot, further, we will also tell rsync not to cross filesystem boundaries (--one-file-system).

Why do we specify slash (/) and boot separately? If you look above at the df listing you can see lots of other filesystems mounted. 
Some of these are ramdisks and virtual filesystems (/sys, /dev, /tmp, and /proc for instance). 
We do not want to copy these at all. By using the --one-file-system and specifying explicitly slash (/) and /boot, we only capture the OS tree of files. ( Note, the rsync is sensitive to trailing slashes on the source and destination directory names, make sure you run it exactly as below)

root@rpints:/home/pi# rsync -av --one-file-system / /boot /tmp/newpi/

[bazillion files copied to SD card!]


(NOOBs Users: If you are running a SD card created with NOOBs, you will need to manually modify the boot/cmdline.txt and etc/fstab files on your new SD card before you can boot. You must edit and substitute the mmcblk0p* device names for the proper ones. 

In the etcfstab, slash (/) should be /dev/mmcblk0p and /boot should be /dev/mmcblk0p1. 

In the boot/cmdline.txt file, root= part should be root=/dev/mmcblk0p2. 

*** NOTE: NO CHANGES APPEAR TO BE NECESSARY

Once you have done that the OS that you backed up will be the only OS on the new SD card even if your NOOBs SD had multiple flavors of raspberry pi OS installed. My scripts on github discussed in the next section handle all of this automatically, which makes things a bit easier.)
These are just a few examples. 

When your ready to try out your cloned SD card, you should unmount it using the following commands. 
Make sure you close any shells or change your current working directory (cd) off the new devices or you will get an error when you try to unmount.

root# umount /tmp/newpi/boot
root# umount /tmp/newpi

You can now safely pull the SD card out and put it in your destination raspberry pi. 
It should boot and work just like any other SD card.

AND IT WORKS! YAY!
 
Thanks, seeing the error messages help a lot, as well as having the commands related to stopping the 'pints stuff handy in one "tome" as you put it.

Edit - it really does work.. I've got a small army of 2 backups now. Yay me. Now if I fry everything while trying to get BrewPi working, I can always go back to the comfort of my taplist by swapping out to a stable place.
 
Hi I'm trying to set up a Multiple Fermentation Chamber system. When i try the ls /dev/ttyACM* command I get no such file or directory. I've done a lot of searching but cant find the answer to my problems. I have cheap unos from ebay.
 
Status
Not open for further replies.
Back
Top