Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Complete beginner wanting to expand knowledge and build something useful

Status
Not open for further replies.
Hey guys,
I'm a complete beginner (I have no experience other than knowing how to wire a plug and light sockets/switches) and I want to learn something new. I hope that's setting you all can help me with. I've been looking for a new hobby project for a while and my other half gave me a Eureka moment the other day. He has a pet snake and his thermostat broke. He's been looking around online and he can't afford a new one of the same model and he doesn't want to get an on/off stat as his snake is very tetchy at the moment and he doesn't want to upset him. He saw a hive thermostat for the home that you can control from your phone via an app and he said he wished they had those for snakes....so why don't I build one for him. I have a Raspberry Pi that I never even got out of the box and it's useless in its current state so my idea is simple (when I say it out loud anyway)

I want to use the Raspberry Pi 2 Model B to create a dimming thermostat we can control with commands sent from a phone via email or however. I'm going to write the script and UI myself using Python (apt name considering its a python I'm making it for) and I have a few ideas in that department but I have no idea regarding the micro-electronics. I have found a few ideas online but thet are all the on or off kind of thermostat.

Can someone help me understand and design the dimming hardware?

I have a thermometer probe that can read the temperature and a raspberry pi so far, I know I will need more hardware, I am prepared for that. Once I understand the hardware I can write the code for the termostat. The base code for the control of the temperature is based on time of day and active temp read from the tank.

The way it will read is it will check the temp every 60seconds with the premise of; read temp, if temp is above (SET TEMP +1°C) turn appliance off and if temp is below (SET TEMP -1°C) turn appliance on. Turns appliance on after (SET TIME AM) and off again at (SET TIME PM)

Obviously this will need adjusting to alternate the voltage/amperage/wattage as I'm not sure what unit we are working on right this second.

PLEASE HELP!

thank you all in advance
 
Welcome to ETO.

First suggestion. Fill in your country location data in your user profile. This will help members provide the correct parts for the voltages and frequencies your country has.
 
So you don't want an on/off "bang-bang" thermostat that just turns on when too cold and off when too hot? You want it to be dimmable (i.e. variable)? Does the heater run straight off 120VAC normally? or does it run off a DC voltage via some kind of power adapter? This is important because different components are used for dimming AC and DC.

They both work approximately the same way though. It turns on and off the heating element many times per second using a solid-state switch (because you need a switch that can switch very quickly, very frequently without wearing out) and adjusts the ratio of the ON time relative to the OFF time to get different levels.

The main difference is in the switch that is used because different switches are required for AC and DC.

With DC, you would use something like a MOSFET transistor. You pick a switching frequency...let's say...20kHz, and you program a control loop into the processor change the duty cycle of the switching waveform based on the temperature input. Possibly, a P controller, PI, controller or PID controller.

AC is a bit different...for technical reasons the simplest switches solid-state switches for AC (triacs) can be turned on but not turned off. That is, once you trigger it to turn on, current will flow through it and it stays that way even after you remove the control signal. The only way to turn it off is to drop the current to zero win the absence of a control signal (such as something else in the circuit disconnecting the current momentarily or driving the current in the opposite direction so it crosses zero). But in AC, you don't need an external device because the AC waveform crosses zero on it's own anyways at 120Hz on 60Hz mains lines. What this means is that your OFF-time is fixed (at the zero-crossings) so to adjust duty cycle you adjust when the triac turns on in the AC half-cycle.

You are basically switching at 120Hz because you can only turn off when the AC waveform crosses zero. Instead you only decide when in each half-cycle to turn on. That means you need some circuitry and interrupts for your processor so it knows (or can estimate) what the AC waveform is. The simplest way is to assume the mains frequency stays at a constant 60Hz and just measure the zero crossings using a timer in between.
 
Last edited:
I have a thermometer probe
Can you post a link to its datasheet? Components may be necessary to condition its output to suit the Pi.
A microcontroller would be more suitable than the Pi for this project IMO.
 
Can you post a link to its datasheet? Components may be necessary to condition its output to suit the Pi.
A microcontroller would be more suitable than the Pi for this project IMO.
Agree, because microcontrollers have lower latency than the pi even though the pi might have higher throughput (important because you need it to react quickly).
 
For simplicity, use a zero-crossing type opto triac.

You can drive one from a logic signal without worrying about timing and it takes care of the zero crossing detail. They can in turn drive a power triac at any rating you need, plus giving isolation between the logic and mains sides of the setup.

Example: https://docs-emea.rs-online.com/webdocs/0d1f/0900766b80d1f184.pdf


Your controller then just gives out a very low speed PWM signal, say 1Hz or 0.2Hz, with the mark-space ratio controlling the average power to the heating element.
It's known as a "burst fire" control, as opposed to phase control where power is applied for some part of every half cycle (like a light dimmer).

It's ideal for heating elements and minimises interference etc.
 
Last edited:
For simplicity, use a zero-crossing type opto triac.

You can drive one from a logic signal without worrying about timing and it takes care of the zero crossing detail. They can in turn drive a power triac at any rating you need, plus giving isolation between the logic and mains sides of the setup.

Example: https://docs-emea.rs-online.com/webdocs/0d1f/0900766b80d1f184.pdf


Your controller then just gives out a very low speed PWM signal, say 1Hz or 0.2Hz, with the mark-space ratio controlling the average power top the heating element.
It's known as a "burst fire" control, as opposed to phase control where power is applied for some part of every half cycle (like a light dimmer).

It's ideal for heating elements and minimises interference etc.
To make it clear, what I described in my previous post was phase control. The main difference is in response time (electrically). Phase control has a time resolution of 120Hz (each half cycle) but more interference because you are cutting directly into the middle of the half-cycle on turn on.

Burst fire has lower time resolution (however many entire half cycles you want on before having it off for some number of entire half cycles), but no interference because you are turning on and off at the AC zero-crossings.

Heating elements have thermal capacity so respond more slowly so fast electrical response has diminishing returns once you it becomes fast enough. So a hot rock with high thermal capacity and slow thermal response wouldn't notice the benefit of phase control, but an IR lamp might (assuming the IR lamp is a kind that can actually be controlled that way...like one that doesn't need a ballast).
 
Last edited:
I want to use the Raspberry Pi 2 Model B to create a dimming thermostat we can control with commands sent from a phone via email or however.

A microcontroller would be more suitable than the Pi for this project IMO.

Microcontroller is more suitable if simply controlling temp. The issue with a microcontroller is the OPs requirement to control with phone and email. If remote control via phone and email is required, vote for the Pi.

I don't think so much concern should be on trying to make the heater dimmable. I think a simple on/off will be fine but use a smarter control methodology to prevent overshoot of the setpoint and to keep the snake nice and comfortable.
 
Research PID control. That allows your setpoint to match the measured value.

Once you know what 0 and 100% are and have a way to measure temperature your almost set,

bang bang control is the simplest, but if you have any thermal mass, overshoot is possible.
You have something called "slow cycle triac". This will essentially make n zero crossings 100%
You have phase angle firing (PAF) where at some point you turn on the triac. Your also working with 1/2 cycles.
You also end up with a table of V^2 vs firing angle vs 0-100%. Power is proportional to V^2 and the resistance of the heating element is constant.

here are two links:
https://ccipower.com/product-category/zero-cross

https://ccipower.com/product-category/phase-angle

I don;t think the PI has the interrupt latency to do either of these.

In the real industrial world, you come up with a lot of choices. PAF is difficult to use with transformers. You can start at how to control and optionally measure power with a 0-100% control signal. A 0-100% control signal on V^2 with a current meter and manual (knob) current limit is one way to go. Tungsten loads or an incadesent lamp dimmer are ususally cheap because 0-100% is not anywhere close to 0-100% power.

I'm guessing that a 0-100% that's time proportional should work for you where the minimum resolution is 1/2 cycle, but you may not be able to support that either so maybe 1sec on, is the minimum on/off time. So, maybe 100 s is a good place to start for 0-100%.

You probably won;t get or use an interrupt on a zero cross, but that's ideal. 0-100% would basically be related closely to 0-100% power. If you had better interrupt latency, then you could use a 1/2 cycle.
 
Research PID control. That allows your setpoint to match the measured value.

Once you know what 0 and 100% are and have a way to measure temperature your almost set,

bang bang control is the simplest, but if you have any thermal mass, overshoot is possible.
You have something called "slow cycle triac". This will essentially make n zero crossings 100%
You have phase angle firing (PAF) where at some point you turn on the triac. Your also working with 1/2 cycles.
You also end up with a table of V^2 vs firing angle vs 0-100%. Power is proportional to V^2 and the resistance of the heating element is constant.

here are two links:
https://ccipower.com/product-category/zero-cross

https://ccipower.com/product-category/phase-angle

I don;t think the PI has the interrupt latency to do either of these.

In the real industrial world, you come up with a lot of choices. PAF is difficult to use with transformers. You can start at how to control and optionally measure power with a 0-100% control signal. A 0-100% control signal on V^2 with a current meter and manual (knob) current limit is one way to go. Tungsten loads or an incadesent lamp dimmer are ususally cheap because 0-100% is not anywhere close to 0-100% power.

I'm guessing that a 0-100% that's time proportional should work for you where the minimum resolution is 1/2 cycle, but you may not be able to support that either so maybe 1sec on, is the minimum on/off time. So, maybe 100 s is a good place to start for 0-100%.

You probably won;t get or use an interrupt on a zero cross, but that's ideal. 0-100% would basically be related closely to 0-100% power. If you had better interrupt latency, then you could use a 1/2 cycle.

Isn't the bang bang mode too crude? When there are valves and / or mechanical switches involved, aren't they destined to be quickly worn out? In my heating system I can hear the valve opening and closing tens of times in few minutes. Somewhat frightening.
 
Isn't the bang bang mode too crude? When there are valves and / or mechanical switches involved, aren't they destined to be quickly worn out? In my heating system I can hear the valve opening and closing tens of times in few minutes. Somewhat frightening.

The OP has a small electric heater for a snake in an aquarium/cage. No valves.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top