Trystan and I have been making progress on designing an emonTx SMT. The idea has been outlined in this thread.
We have done a number of blog post documenting the various aspects to the design, see:
emonTx single AC supply
High Accuracy Current Measurement over a Wide Range
Arduino Leonardo ATmegA 32u4 and RFM12B
The current general idea is to use an adjustable gain op-amp front end based on the Atmel energy monitor app note hooked up to an ATmega32U4. This MCU has built in USB controller therefore no FTDI programmer will be needed. The ATmega32U4 with the Arduino Leonardo bootloder is supported by the latest version of the Arduino IDE.
So far we have done some simulation, built a prototype and have done a preliminary PCB layout design. I'm about to go away for a few weeks so work on the PCB design will slow down. I thought I would post up here my progress so far.
See attached for Schematic, preliminary board design, Port Map spreadsheet and Eagle CAD files.
The PCB is 100 * 80 mm, it's been designed to slide into an extruded aluminum case with laser cut fascias for the ports.
I would be interested to hear if anyone has any thought on the design so far. In particular the PCB layout and splinting of the digital and analog GND planes. It's getting to be quite a complex board. Initially attempts at routing have been difficult since there are so many signals to route in and out of the 32U4. I think the component placements will need to be further optimised, in particularly the digital control lines to the bilateral switches where giving me trouble. Any ideas would be appreciated.
As I mentioned earlier, I'm about to go away for a couple of weeks so I won't be able to fully engage with this thread for a number of weeks.
do you think that the MCP1702 can handle the power dissipation if the ethernet module is mounted (plus one of the RF modules)? Especially with higher voltage levels on external power (3? to 13V) there should be a problem (although I do not know the typical supply current of these modules exactly).
The SOT23 can not handle more than 200-300mW and then it also needs a bit more copper around it to get away with the heat.
On the other hand, why is the 56R resistor so big (7W)? I would think that not more than max. 1W should be ok (but this for sure depends on the output voltage of the transformer used).
Don't mind my comments, go on with your excellent work.... and hopefully we will see this in the shop in the near future :-)
Edit: forgot to attach the .pdf with the thermal calcs, here it is :-)
I had thought that the power consumption would be much higher for the basic setup. I could remember a current of 23mA for the RFM12B alone but this is for tramsmit mode only. And I really thought that the rest of the system would draw a bit more (including LEDs).
So for this basic setup everything should really be ok. I would assume a maximum of 50°C ambient (at 70° the aluminium case would burn your skin when touched and this would also be a safety issue) and then the maxiumum current that can be drawn from the MCP1702 at 5.25V input and 3.3V output would be appr. 100mA. But it would get very hot and the calculation is only correct for optimum heat transfer from the MCP to the (datasheet says 4-layer) pcb.
It could help to use the SOT89 package option for the MCP as this has less than half the thermal resistance. And it would be advisable to use copper planes of min 1cm² to dissipate the heat from the ic package. These copper planes could be connected to the central GND tab either directly on the same pcb layer or via a number of vias to another pcb layer.
For the supply of the WIZ820 you could decide to use an extra MCP. It is not very expensive and this would also decouple the power supplies which could help to keep the analog reference clean from transients on the wiznets supply.
Regarding the 56R resistor I see that you want to cover the worst case peak power, which is perfectly reasonable. At the same time the thermal inertia (or capacity) is high enough to average the power peaks. And then I think that due to the half wave rectification you have to take only half the cited RMS value of 16.8V for calculation. Or is this nonsense?
Anyway, it is always good to stay on the safe side with component dimensioning. I have seen too many bad designs where you can burn your fingers or where the pcb changes its colour from green to brown after some time.
Jörg. Or is this nonsense?
You need to calculate the average power (rms power is a nonsense - there is no such thing!). At a first approximation, if the resistor is dropping 12 V at 100 mA for 5 mS per cycle, then the power is 12 x 0.1 x 5/20 = 300 mW. Of course, the currrent is not a rectangular block. To get closer, PSpice can help:
Plot the power in the resistor (= (voltage on end - voltage other end) * current) then use the "wavform arithmetic" (see Help) - Ctrl-left click on the power trace - to have it calculate the average.
And agreed - conservative rating is good for component life too.
(Warning - avoid wirewound resistors that are subject to pulsed currents, the thermal shock can cause early failure. Carbon (!) or metal film are OK).
Thanks Robert I'll get on to doing that.
(comment deleted and rewritten, because I was unable to express what I meant to say, sorry!)
we agree that Glyns peak power calculation is absolutley correct.
If we think that we can take average power for dimensioning the resistor, one could do an upper limit calculation as follows:
- If the transformer has a peak voltage of 16.8V, this corresponds to roughly 12V RMS
- connect a 56 Ohm resistor to this voltage, this will result in an RMS current of ~220mA
- this gives 2.6W of power dissipation
- due to the halfwave rectification of D1 the current will flow only half the time, so power diss. will be reduced to 1.3W
- combined with conduction losses in D1 this will be reduced to 1.2W
- if the MCP1702 output is not short-circuited, then the power dissipation will be reduced to ~0.6W
Hope this makes sense now.
First prototype PCB's have arrvied!
So far I've soldered about 1/3 of the resistors. I'm still waiting for the IC's to arrive. I'm going away for a week or so on Thursday so the moment of truth will have to wait a while! Still, it's very satisfying to physically hold the board. Spirit Circuits have done a great job, it looks very well made.
I've been looking into voltage regulators tonight. I'm going to go with the MCP1702 in SOT-89. This package is just over 6 times better at dissipating heat than the SOT-23! Calcs show that it should be able to deliver over 600mA with a voltage drop of 2.9V in 50 degree ambient. Obviosuly this it outside it's max current spec but it shows that it should be able to deliver all we want. It might be a good its to have a sperate regulator for Wiznet and Xbee but I'm keen to try and keep thinks simple. I'll keep this in mind in case we do have power supply rail coupling issues.
Will try and look into current limiting resistor sizing tomorrow.
very nice board indeed!
Although I think that the MCP1702 in SOT89 is a good choice , according to my datasheet the thermal resistance is 153 °K/W instead of 336°K/W of the SOT23. Dissipating ~1.7W should be very hard also for an SOT89 with excellent coupling to a (BIG) copper plane!
Glyn, what are your long term aims on the future of emonTx/base etc. ?
Building things in SMT is fine, but moves far away from the home builder - do you have plans for a new eMonTx - nonSMT version ?
Additionally, do we really need so much CPU power in a sensor board ?
I've finally got round to revisiting the calculator for the 56R current limiting resistor.
JBecker: you will be happy to hear that your approximation almoast exactly matched what the simulation indicated.
Robert: Thanks for your excellent explanation of how to calculate the average current using LTspice. I did just that:
Assuming a worst case senario of 150mA current draw (PTC fuse blowing - 40mA holding, 150mA blow) and maximum UK mains voltage (16.8V peak) the peak current draw through 56R is 2.66W and the average is 0.625W. This average current can be handled with a 2010 SMT resistor...much better!
Stuart: Sorry for the slow reply, I have discussed our plans for the emonTx SMT in a blog post: openenergymonitor.blogspot.com/2012/08/emontx-smt-progress-update.html.
Progress on testing the emonTx SMT has been slow, most of the fiddly soldering (SMT passives and MCU) is complete but I've not yet had a chance to power up the board. Hopefull I will have some progress to report on soon.
Glyn, looking at the variable gain OpAmp circuit (which I've also built) and wondered why the original AVR designers went for Bilateral switches rather than a digital potentiometer ?
The digital pot costs around the same as the bilateral switch, but gives more steps of resolution and takes up less board space?
The only benefit I can see is "real resistors" are generally better tollerance than the digital pots - but this could be catered for in the software.
Their choice of steps is also useful given you can go bit shifting to set the multiplication factor.
Could you provide details of your design? Although we have put quite a bit of work into testing and making a prototype PCB for the AVR App note design we are still intersted in looking at alterative designs.
One problem with the AVR appnote design is that each channel requires two channels of digital control lines to control the bilateral switches. It's this which made us only include three CT channels, the op-amp can support to to four, we just ran out of I/O's!
I don't have any experiance with digital pot's, it's possible they could provide a nice solution. In terms of communication the RFM12B (interrupt driven) and possibly an Etherent module could be using the SPI bus, it's possible the bus could be gettting quite crowded. I2C could be an option but the I2C I/O's on the 32U4 are shared with INT0 and INT1 which are currently being used for the RFM12B and pulse counting interrupts on the emonTx SMT prototype design (I've attached a port map).
It looks like digital pots are only easily available up yo 100K. The bilateral switch AVR app note design give an effective resistance switching of 6.8K-276K.
The main reason why we went for tha app note design is that it's a tried and tested (at least by Atmel) design and should perform well.
I realize this might be a bit late since you've already produced the boards, but you could have also used an opamp with a built-in PGA, for example the Microchip MCP6G0x series. This would save quite a bit in component count and board space. The cost would probably be about the same, especially if you factor in assembly.
I'm really looking forward to the EmonTX SMT units. I was just wondering if there are any updates on when the EmonTX SMT units might be available in the shop? (I certainly don't mean to be impatient. I know these things take a long time to fully test and tweak).
I need to buy 6 EmonTXs some time before the 2nd week of Jan and I'm wondering if I should hold off to get an EmonTX SMT?!
What Jack said!!!!
Any News ???
Sorry for the lack of updates. The emonTx SMT has taken a bit of a back seat lately. Over Christmas we've been flat out keeping the shop stocked and running. The latest of the emonTx SMT is I finished building it up and after a little flying wire fix the board sprang to life! I uploaded the Arduino Leonardo bootloader and was able to upload code via USB from Arduino IDE. All the features I tested worked fine: wireless, temperature etc.
Trystan and I proved that the the multi gain CT inputs are working as simulated but we are yet to write firmware to auto switch between gain levels. This is about as far as we got with testing.
Recently we have been giving some more thought to moving to SMT. We are still keen to do it. However it has become apparent that the complexity of this design means is will be relatively expensive to get manufactured. Based on the manufacturing quotes I have received I estimate that we will probably have to sell it for about £100 including a case and one CT (no power suply). We think this is a bit too much for just an energy monitoring base station, and we don't think people really want the extra accuracy of the multi gain input stage. The accuracy of the old emonTx is probably good enough for most users. What do you think?
Taking this onboard I've been working on a SMT design based on the current emonTx design. We hope to be able to manufacture this hopefully for a similar price to the current emonTx (about £40 including one CT). I think the extruded aluminum wall mountable case is a good idea. I'm designing this new design (I'm calling it emonTx V3) to fit in a 80 x 67mm case. We are keen to get this unit into production as soon as possible, but I imagine it will be the middle of this year before we launch.
Once the emonTx V3 has been released we will think about getting the emonTx SMT (as described above) into production as a more expensive but more accurate and fully featured option.
I would love to hear you thoughts on this plan.
What's the reason for wanting to go to SMT for the current emonTx? Is it so that you can sell assembled units more easily?
For me, one of the main attractions of the current design is that it's easy to change or replace components, especially if it's going to be in the house for a long time. If I'm messing about in 5 years time and blow up a CPU I'm sure I'll be able to find another one. If I did the same thing with an SMT board I'd at best have to buy another board and at worst you'd have stopped supplying them and I'd have to start again.
did you think about using an external 12 bit ADC? I did some tests with an MCP3208 (MCP3204 for 4 channels), results were quite good (factor 4 better accuracy, as expected) and price is ok (less than €2.50 @50 pieces). Conversion is also much faster (~8us).
Have a chat (via PM if need be) with forum member Brian D - he's got lots of experience when it comes to small scale surface mount manufacturing.
Did someone mention my name?
It’s true that I have built a few surface mount products maybe 100,000 or so. But this was back in the 1990’s. Anyhow, this is what applied in those days:
The products were radio controlled modelling accessories which I sold mostly into Germany – it’s a big market but even so the order size was often less than 1000 units so if tooling up for pick and place it only became cost effective when doing a run of about 5000 pieces.
My solution was to use larger SMD’s and have the boards hand assembled. This may seem crazy but it was cost effective. The increase in PCB size was compensated by using through-hole devices on one side and SMD on the other. The PCB’s were often copper on one side only. Minimum passive size was 1206. IC's were 50 mil. The operators doing the work were very skilled and the product reliability was surprisingly good.
I don’t know how people get around the problem of small batch size these days but when I was in business it was a big problem.
Maybe the energy monitoring market is bigger – but I doubt it. Also, I like the easy re-work capability of your existing products so for me the SMD version is not attractive.
thanks for your update
IMHO £100 for the EMonTX SMT is too expensive!
I think once you go into the SMD market, the hobby angle is lost as its just too damn tricky to attempt to solder yourself or requires lots of specalist tools (and good eyesight!)
Perhaps invest your time looking at ready built emonTx devices instead - the current circuit design works well in my opinion.
I would like to look at the ability to add in a switchable gain stage - but this could easily be done with a daughter board against the existing emonTx modules.
I don't think physical size is really an issue for most people, the units are chucked into a meter cupboard or stuck in the garage next to the meter box.
I think it may be worth considering dropping the Nanode product range for the base station though - the Rasp PI is just so cheap and really powerful - especially with the RFM12 interface.
@martinR Reason for going for SMT is to make the system more useful for more people, I feel the pain of the people having to assemble 50 + emonTx's for community energy monitoring projects etc. Don't worry the thru-hole design won't be going away, this is the beauty of open source! However in the future we will re-evaluate for how long we will sell thru-hole kits in the shop. Putting the kits together is quite labor intensive.
@JBecker Yes, I agree. external ADC is the way to go for billing grade monitoring performance. MCP3204 looks like a good option. Have you published/blogged your testing results?
@stuart Yes, again I agree. The RFM12Pi is slowly superseding the NandoeRF. However I think the NaondeRF does still have a place. Since it's easier to understand how it works for beginners school/students. The RasPi is great but its quite a daunting beast for people with no Linux experience.
I've just posted up a blog post on our latest progress on an emonTx SMT design: http://openenergymonitor.blogspot.com/2013/02/emontx-smt-update-introducing-emontx-v3.html
I would love to hear your thoughts on the emonTx V3 design.
Open-source tools for energy monitoring and analysis. This project uses the GNU General Public Licence