DomoticCathouse
A cathouse is an house for animals like cats with central target to make them feel comfortable even during winter season.
Build a cathouse from scratch requires some abilities such as:
- cut wood parts using Alternative Hacksaw
- print 3d parts ( wood walls spacers, door hinge, electronic boxes )
- etching electronic pcb, soldering components, cabling dupont and molex wires, testing
- flashing MCU firmware ( vscode arduino esp8266 )
LICENSE, DISCLAIMER NOTICE AND PRECAUTIONS
- Project source code is covered by MIT license so it can be used freely either for commercial purpose
- Project hardware
IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE HARDWARE OR THE USE OR OTHER DEALINGS IN THE HARDWARE
- In short this project is developed by me at best of my knowledge but there is no any warranty about that it will work or that it can produce damages, so USE AT YOUR OWN RISK and take care of precautions listed below
PRECAUTIONS
- wood cutting
- use protective gloves
- use safety goggles
- fix wood parts firmly before proceed to cut
- 3d print
- don't let 3d printer work without a human supervision of the print process
- don't stay in the same room of 3d printing ( better to use a wifi cam to check printing process )
- pcb etching
- use a protective mask to avoid irritation to the respiratory tract when using acetone to transfer toner to the copper plate and when clean toner using nitro diluent
- use protective gloves when handle pcb for insertion/removal from etching tank containing sodium persulfate
- cathouse
- position
- under a roof to protect it from rain
- on an elevated place to avoid water immersion in case of rain
- place 4 x 5kg weights on top near corners to increase wind resistance
- electrical
- place power outlet connection to the top blocked by weights
- disconnect from mains when working at the bottom electrical part to avoid shocks from inadvertently touching power supply 220/24V tansformer connectors
- use a sheat group cables and ensure position by inserting a constraint at the bottom to avoid cables move touches kanthal hot wires
- interpose on the phase wire a 40C normally closed thermostatic button to ensure power disconnection if something goes wrong in the control and temperature in bottom part increase over 40-45C
- kanthal hot wire
- use refractory mortar as base under each kanthal hot wire to protect bottom part from direct contact to the wood
- fasten the wire between the two washers so that it is slightly taut between the two uprights
- don't touch kanthal hot wire when port switched on
- use 24V for AWG34 30cm kanthal A1 wire ( it will consume about 0.96A @24V and wire will be red and move lowering for about 1-2cm max ) ; doublecheck wire length using procedure described in steps
- fix hotwire supports to the bottom using two selfdrilling screw to avoid tipping in case of inclination during transportation
- position
Project Source Code, Bom, Drawings
Project source code, billing of materials and drawings are available here.
Click on "Clone or Download" to clone git repository or download a zip containing all the files:
- cathouse-controller ( is the MCU cathouse controller firmware )
- doc ( contains bom.xlsx, pcb pdf and cathouse-drawings )
- cathouse-analysis ( is an example for an automation from an external pc through webapi )
3D Print, Labels and Guidemask
- Print 3d parts accordingly to bom quantities ( "3DPRINT" worksheet )
- Print on paper scale 1:1
- esp8266-labels.dxf and apply to mcu cover to help identify bottom-view pinouts
- guidemask.dxf that will useful to sign spacer hole position onto wood walls
Inspect Drawings
Dxf technical drawing files can be opened using free viewers, personally I found useful to open files for wood cutting activity through smartphone to have drawing quotes available at hand. For that I used DWG FastView application.
Principal dimension quotes are already present in drawing but you can measure either from smartphone some specific length using tools from viewer application. Units are in millimeters.
Following is the list of drawings that can be found in doc/cathouse-drawings folder:
- project.dxf ( cathouse main project drawings - walls )
- stairway.dxf ( describe how to cut 3 + 3 pieces needed to assembly stairway )
- kanthal-wire-support.dxf ( describe how to cut 4 + 8 pieces needed to assembly kanthal wire support )
Cut Wood Parts
As bom file describe prepare follow materials, cutting if needed, poplar plywood, fir strip and polystyrene with follow ( measure mm ):
- poplar plywood panels
- 8 x 830 x 600 ( 2+2 for base and top, 2+2 for two longitudinal walls )
- 4 x 556 x 600 ( 2+2 for two transverse walls )
- 1 x 790 x 560 ( floor )
- 1 x 700 x 400 ( weight floor )
- stairway ( using 3 x 274 x 600 resulting from previous cuts )
- kamthal wire support ( using 1 x 274 x 600 resulting from previous cuts )
- fir strip
- 2 x 780
- 2 x 550
- polystyrene
- 4 x 830 x 600
- 2 x 556 x 600
As a general rule to cut using alternative hacksaw prepare on wood traces drawing two lines using a pencil offseted for about 2mm ( take care to not offset toward the main part but toward the residual one to ensure an exact length of the cut ).
(optionally) Build an airfloow aperture in the floor using the mask from guidemask.dxf ; there are many holes to open an approach is to place the mask with scoatch then mark with pointed object each hole center, then remove the mask and proceed to drill each hole using drill bit 5 mm diameter.
Cut Window and Door Shape
- fix two wood panels using clamps
- apply some little holes for about 1cm then increasing electric drill speed and tilting a bit glue each point to form a continuous trace aperture
- insert hacksaw knife into aperture and proceed to cut the piece until line end
Assemble Walls, Top, Bottom
Walls
- use printed guideline for apply holes to attach panel spacers
- insert spacer and fix with washer + 15mm selfdrilling screw
- apply polystirene panel over making a little pressure over spacer to have guideline impressed to cut out a part where each spacer enters
- apply counterpart wood panel with holes already applied and fix with washer + 15mm selfdrilling screw ( take care to execute holes accordingly to project.dxf file so that they will be staggered and they do not conflict themselves )
Window
- apply a little frame around window aperture to avoid glass exit and place the glass in the wood aperture, then fix it using some glue; when the glass will be insured apply some silicone for better thermal insulation
- cut out window shape from polystirene panel so that it overlaps the glass for about 5mm ( to maintain glass under pressure from inside outside ) and enclose like for the walls with other counterpart wood panel ( there will be two glass, one external and one internal )
Door
- prepare the door sandwitch applying door tierod holder spacers and glue lower part where there aren't spacer to tight wood on polystirene
- door can be inserted or removed even if the transverse ingress main panel already assembled by align the door and by inserting M4 long tierod from the side through door fixating spacers
- double check that the door can rotate freely adapting if necessary support to avoid too much friction
Apply cold sealant
- apply adhesive sealant to bottom, top and transverse panels laterals as described in project.dxf drawing
Assemble Bottom Frame
Ensure two transverse square hollow alu profile using bolt and nuts
- insert bolt and apply nut only at head
- retract the bolt as shown in the picture
- align square hollow and scraw the bolt so that nut lock itself due to inside contarct within the alu profile until it fixates
- this way there will be about 1.5-2cm of bolt inside to resist vertical cut forces
Assemble Kanthal Wire Support
Doublecheck wire length
- kanthal A1 wire is a wire that can work at high continuous temperature ( 1400C )
- our constant voltage source is 24VDC
- using AWG34 kanthal A1 wire the length for 24V would be 30cm
- to activate hot wire place 24V- and 24V+ crocodile clip in two point of the wire at desiderd distance
- more is the distance, more is the resistance, less is wire power dissaption then temperature generated
- less is the distance, less is the resistance, more is wire power dissipation then temperature generated
- we need to doublecheck exact length using a simple lab test as follow
- place the wire on a surface that resist high concentrated temperature and keep flammables away the table
- place one clip at end point A fixed
- place other clip at point B on a distance from A of 40 cm to start in a safe region ( don't touch the wire by hand to avoid burns )
- reduce distance by moving B ( deatch and reattach 1cm by 1cm ) toward A until the wire gets little red and stop in that condition turning off power supply
- write down the distance and use that as reference for the distance between two fixation kanthal support treaded rows ( note that if measured distance differs from 30cm you'll need to adapt kanthal wire supports design )
Support
- note : if measured distance differs from 30cm adapt length of longitudinal support accordingly
- cut 8 pieces 8cm length each from M4 tierod ( I used grinder to cut and smooth rotating tierod keeping the grinder at 45 degree each end in order to allow nut screw easily into the tierod )
- apply holes for vertical M4 treaded row
- compose H shape and insert treaded row with washer+nut foreach part then tight
- apply 4 soft spacer under transverse wood stabilizers
- apply a selfdrilling screw at midpoint of the longitudinal wood to form a central support in order to avoid wood bending
- using some paper and scotch prepare 4 container around longitudinal wood pieces for an heigh of about 5cm
- prepare refractory mortar ( see vendor spec for water/sand proportion ) for a total volume of 0.000071 mc ( 4 x 35.5cm x 5cm x 1cm ) in order to make a jet of 1cm thickness.
- strain the mixture in equal parts into 4 supports
- leave material for hardening ( see vendor spec )
Electrical and Kanthal wire
- cut 4 wire pairs ( 25W rated ) for a length of about 35cm each pair
- foreach pair strip out the sheath for about 25mm
- take a look at photos, each tread row composition for wiring is composed in order from bottom to top as follows
- M4 hexnut
- 24V wire
- M4 hexnut
- M4 washer
- kanthal wire
- M4 washer
- M4 self locking washer
- M4 hexnut
- connect each 24V pair between hexnut foreach of 4x2 tierod support
- for kanthal wire fixation
- place a washer over the hexnut
- fix the wire on the first tread row making 3 turn around trying to stay low at the same thread
- place a washer above, then spring lock washer and head hexnut
- using a wrench no.8 gently close the packet without tight too much in order to avoid damage at the wire
- do the same for the other threadrow of the same kanthal wire support and cut excess leaving 1-2 cm
- note: wire not need to be in tension but just what is needed to make it straight between two endpoints
Security improvements
after 3 years from installation it worked good, but one kantal wire got broken in a point of about 20% of its length just yesterday; this could an issue if the broken wire go to touch other electrical parts; to avoid that vertical wood walls should placed around each kantal station for a height enough to retain broken wire and at same time allow heat to flow from the upper part of the wall in normal condition.
to detect if a wire was broken without opening the bottom base, simply use a current measurement tool, enable kantal wires from the web interface in manual mode and check if current consumption increase or not.
Assembly Cathouse Walls
Cathouse can be assembled and disassembled easily for summer storage, for example four vertical walls can be disassembled to stack them over the bottom and top parts.
- take a look at project.dxf ( transverse walls are kept inside longitudinals )
- place bottom on a surface and place bottom frame over and centered onto it
- cut if the excess of inner cold sealant if needed in order to avoid the frame gets thicknesses below
- door element have to be constrained to the transverse ingress wall through M4 long tieroid
- take the longitudinal window wall
- fix ingress transverse wall using long 50mm selfdrilling screw ( keep aligned to reach correct hole in the spacer of the transverse wall )
- fix ingress back wall using 50mm screws
- fix longitudinal blind wall to other 3 by using long 50mm screws
- try to insert the floor panel and adapt if necessary so that it can be easily inserted and removed ( there are no need for fixation between the floor panel and bottom frame, it will be sustained by all the around frame and by the transverse alu profiles )
Build Mosfet Driver
Mosfet driver purpose is to allow esp8266 to power each of four heat port indipendently; it acts like a relay trigger but wihtout mechanical issues ; IRF740PBF datasheet here ( each mosfet can drive about 50W, we need to use for about 24W )
- full circuit available.
- print doc/electronics/mosfet-driver-pcb.pdf file to coated photo paper and transfer to a copper plate cm. 10 x 7 to finally etch the pcb using procedure described here at toner transfer section
- optionally print doc/electronics/mosfet-driver-labels.pdf to apply pcb labels on the other side
- drill pcb using bit for hole sizes as follow
- 1.3mm ( mosfet )
- 1.1mm ( data dupont connections H2 )
- 1.0mm ( pcb connectors J1-J4 and V1, optocouplers U1-U4 )
- 0.9mm ( resistors )
- mount components
- insert pcb into 3d printed box ( doc/cathouse-drawings/mosfet-driver-box.scad )
- D1,D2,D7,D8 ports now can drive mosfet by applying a 3.3V tension with a consumption of about 7mA that is below the max of 12mA regards esp8266 digital ports
Build Instrument Opamp
Instrument opamp purpose is to amplify little 1mV signal of 5kg loadcell (flat type) to a range of 1000mV suitable for use within esp8266 10bit ADC ( port A0 ). Signal contains some noise as can be seen from photos but cathouse manage these by computing the average over last 20 samples ( a sample recorded each 2 seconds ) and by comparing this mean value against past samples average until another cat enter/exit event occurred.
Through web interface ADC weight mean cat in minimum allow to set the value of adc weight to consider cat in there, while cat exit threshold minutes allow to set a minimum time before system going off after weight decrease under minimum level.
- full circuit available ; a simulation available here
- print doc/electronics/load-cell-opamp-pcb.pdf file to coated photo paper and transfer to a copper plate cm. 5 x 3.5 to finally etch the pcb using procedure described here at toner transfer section
- drill pcb using bit for hole sizes as follow
- 1.0mm ( pcb connectors and dupont JRG gain test resistor, J2 output signal connector )
- 0.9mm ( V1 power, resistors )
- 0.8mm ( U1 LM324N 2x7 socket )
- mount components
Build Loadcell Fullbridge
- double check your load cell sensor bridge wires by identification of
- common wire
- variable resistor wire
- fixed resistor wire
- in my case I had red for common, black for variable and white for fixed but this can change depending on specific model
- with two 1k (1%) resistor the 5kg half-bridge load cell came into a fullbridge where S- and S+ is the signal output of about 1-5mV
- to identify wires use a multimeter set to resistance measurement, connect multimeter clips to two wires of the loadcell
- if you see 2K these wires aren't the common so the third not attached is the common
- if you see 1K you need now to check if it's a variable or fixed resistor wire
- apply a force over the sensor ( make sure the sensor is in its holder support to allow internal "T" element to bend correctly )
- if multimeter shows variation 0.997-1kOhm then write down this wire colour this is the variable resistor wire while the other one, that isn't already signed as the common, is the fixed resistor wire
- form the full bridge adding two 1k (1%) resistors
- check if the bridge is functional by connecting the opamp
- power opamp V1 with 5VDC
- attach A- A+ from fullbridge to the opamp J1 connector
- apply excitation voltage 5VDC to E- E+ of fullbridge load cells
- connect voltmeter to GND and opamp output amplified signal J2
- if everything correct you'll see a signal 0-1V by applying 0-5kg over the cell
Mount Upper Floor
Upper floor have two reason to exists:
- bottom floor heat to distribute in a better manner
- detects cat presence
Just place four square pieces of poplar plywood cm.2x2x0.5 at four edge and the load cell over the bottom floor in the zone where there is the transverse alu profile to increase reactivity in weight detection.
Place two screw to avoid panel slide.
Electronic Parts Assembly
- full circuit available
- mains powers are 5VDC and 24VDC transformers
- 5VDC provide powers to
- central esp8266 MCU ( GND, VIN )
- led
- fan (optional)
- for security reaons before to reach 24VDC there is the need to interpose a thermostatic button normally closed 40C on phase wire
- 24VDC from transformer connects to mosfet driver pcb connector 24V (V1) and then mosfet driver itself provide powers at four hot wires through J1-J4 ports
- 5VDC provide powers to
- MCU connects to
- USB cable for programming/serial debug
- (3V3, D3) for thermometer sensors onewire interface
- (D1, D2, D8, D7, GND) to corresponding mosfet controller (P1, P2, P3, P4, GND)
- (P5, 5V, GND) to led
- (P6, 5V, GND) to optional fan
- (5V, GND) to opamp V1
- (A0) to opamp J2
- loadcell E+ E- to 5VDC and GND and A+ A- to corresponding opamp ports
Reduce FAN Noise
I changed standard 80mm fan that worked also at 5V with another one ( see bom ) that required at least 6-7V to enable but that produce lower noise 9.1dB/A.
To make it work I added a XL6009 step-up (in 3-32Vdc out 5-45Vdc) tuned so that 5V input step up to 9V, printed a base box and soldered wires with molex connectors.
More I detached the fan from direct contact with wood to reduce beats and acustic propagation and it still works as hot air extractor from bottom to the ambient, it can be seen in last photo where after a 10 min fullpower activity where bottom temperature reaches 35C fan activates and the ambient temperature ( yellow ) increase slope from previous.
Final Touches
- paint exterior with acrylic color
- apply 4 cable management pieces to block led and ambient temperature sensor wires
- apply a soft coperture to the upper aperture of the door in order to increase insulation
- glue two preholed blocks lateral downside of the last stairway step and fix that to the transverse ingress wall for an easy stairway attach/removal
Uploading Software and Setup
Requirements
- Arduino IDE/SDK
- File/Preferences/Addictional Boards : http://arduino.esp8266.com/stable/package_esp8266...
- Tools/Libraries/Library Manager
- ArduinoJson
- DallasTemperature
- i2cdetect
- Json Streaming Parser
- Memory Usage
- OneWire
- Visual studio code
- clone source code repository
Upload
- from visual studio code / File / Open Folder
- choose cathouse-controller folder
- CTRL+ALT+R to check compilation successful
- CTRL+ALT+U to upload sketch
Setup Wifi ssid,pwd
- open USB serial port using minicom 115200 8N1 ( verify that port is not already opened by vscode )
- enable echo using CTRL+AZ E
- enable carriage return using CTRL+AZ U
- press CTRL+C to stop wifi connecting
- press ? to enter SerialOS
- set wifi ssid SSIDNAME
- set wifi pwd WIFIPWD
- reconnect
Connect to the address of wifi device ( see serial dump at starts that reports IP and MAC address )
- http://xxx.yyy.zzz.www
- better approach is to fix the IP by inserting the association in the DHCP MAC address IP reservation table of your wifi router of other lan DHCP server you using
Setup heating strategy
- automatic mode
- when cat enters all ports enabled until reaches Target T from limit value from either one of bottom toward Bottom temperature limit or wood toward Wood temperature limit
- if some limit condition occurs system goes off for given cooldown time
- bottom temp great or equals bottom temp limit
- wood temp great or equals wood temp limit
- ambient temp great or equals ambient temp limit
- if external temp great or equals 'Extern >= T sys OFF' then system goes off independently cat is in there or not
- manual mode
- links p1,p2,p3,p4,fan enabled to be toggled from web interface manually or from webapi through external automation