Design check for an advanced coffee grinder timer

Since this is one of my first real schematics with eagle and it is also controllong mains voltage with a relay I'd be grateful if someone could look over the schematic!

(I already have a working prototype, however it is using a pre-made relais board)

Some comments

Where is the power coming from? Don't see an power input. And depending on the source you might want to add a capacitor on the board just to have a local buffer. Place it near the Arduino.

For the potmeter, swap the 5V and the wiper pins on the connector. That way if you reverse the plug nothing breaks (only inverts the scale) whereas now you put the voltage between the wiper and GND when you reverse it which might burn the pot if it's set pretty low.

If you place the buttons between GND and a pin you don't need external pull down resistors. Just turn on the internal pull up resistors. Yes, the logic of a button is inverted but that's not a big deal, just flip it in software as well :wink:

I do like it very much you put GND low and the 5V symbols up :slight_smile:

A lot of I2C devices already have a pull up resistor on the data lines so maybe they are redundant.

Be sure to grab a mains rated (no fuse so at least X2) for C_SNUBBER.

It's more common to let the software number the components instead of names.

The relay symbol is a bit weird and I can't see a type name. But if 11 is the common then 12 looks like to be the NC contact. Do you want the AC to be on if the relay is off?

A 1N4148 would suffice for the flyback diode and I would even prefer it over the 1N4007 becasue it's faster (and cheaper).

And not because it's wrong but why not use I2C for the BME280 as well? And I assume both the display and the sensor are both close to the board? I2C and SPI are both not designed to length.

Thanks for taking the time!

septillion:
Some comments

Where is the power coming from? Don't see an power input. And depending on the source you might want to add a capacitor on the board just to have a local buffer. Place it near the Arduino.

Power is coming from the USB port. I checked my power requirements and I will come out at (max. rating):
50 mA Relais
8 mA OLED
5 mA LED Relay
~10 mA button/encoder/etc.

So I'm using the Nano's voltage regulator and power everthing through +5V. As a capacitor I looked around and found recommendations of 1-100uF. So I selected a 22uF electrolytic cap, which should do the job.

septillion:
For the potmeter, swap the 5V and the wiper pins on the connector. That way if you reverse the plug nothing breaks (only inverts the scale) whereas now you put the voltage between the wiper and GND when you reverse it which might burn the pot if it's set pretty low.

VCC and GND are actually on opposite sides, the 5V label is just a bit to the left.

septillion:
If you place the buttons between GND and a pin you don't need external pull down resistors. Just turn on the internal pull up resistors. Yes, the logic of a button is inverted but that's not a big deal, just flip it in software as well :wink:

Will do so for my next project, for now it is just easier to solder three resistors than go through the code again.

septillion:
I do like it very much you put GND low and the 5V symbols up :slight_smile:

Thanks :slight_smile:

septillion:
A lot of I2C devices already have a pull up resistor on the data lines so maybe they are redundant.

On the super cheap ones which I ordered I couldn't find any, so I decided to include some for the printed PCB.

septillion:
Be sure to grab a mains rated (no fuse so at least X2) for C_SNUBBER.

It's an MKP-X2 305 V~

septillion:
It's more common to let the software number the components instead of names.

I wanted to make ita biteasier forme on the PCB :wink:

septillion:
The relay symbol is a bit weird and I can't see a type name. But if 11 is the common then 12 looks like to be the NC contact. Do you want the AC to be on if the relay is off?

It's a Finder 43.41.7 5V 250VAC 10A Relais. Eagle doesn't have this specific model so I got it externally. However, contact 11 is the common, and the switch occurs between 12 and 14.
If I am not mistaken, the connection between 11-12 is the off-state and 11-14 is the on-state. In the datasheet 11-12 are also connected in the symbol. Or am I making a mistake in reading it? datasheet

septillion:
A 1N4148 would suffice for the flyback diode and I would even prefer it over the 1N4007 becasue it's faster (and cheaper).

Thanks for the tip!

septillion:
And not because it's wrong but why not use I2C for the BME280 as well? And I assume both the display and the sensor are both close to the board? I2C and SPI are both not designed to length.

I've tried for several hours to get my BME280 working alongside the OLED but didn't succeed. as soon as the BME library was loaded the display would only show white noise. Maybe it was partly because a levelconverter was used with the BME, but since it has also SPI interface and I had enough pins to spare I used that instead.

jazzar:
Power is coming from the USB port.

Alright, power requirement is indeed not that large. But if it's from USB I would definitely add a cap. Problem is, you don't connect the power from USB to the 5V power in your schematic :wink: Connect the power symbole to the 5V of the Arduino as well (which is weirdly labeled as 5.5V...).

jazzar:
So I'm using the Nano's voltage regulator

No your're not :wink: If you power it from USB the regulator is bypassed and not in use.

jazzar:
So I selected a 22uF electrolytic cap, which should do the job.

Go bigger. I would say 100uF as bare minimum.

jazzar:
VCC and GND are actually on opposite sides, the 5V label is just a bit to the left.

I see now :slight_smile: I would or move the label to the right or move the wiper wire down and the 5V label up.

jazzar:
Will do so for my next project, for now it is just easier to solder three resistors than go through the code again.

Really?! :o If you organized the code nice and/or implemented debounce you only read a button in 3 places (each button once) so that should only mean changing it in 3 places. If you did bare reading that would mean just replacing digitalRead() with !digitalRead(). If you didn't than that's something to do in a next project :wink:

jazzar:
On the super cheap ones which I ordered I couldn't find any, so I decided to include some for the printed PCB.

Indeed better safe then sorry :slight_smile: You can always leave then off.

jazzar:
It's an MKP-X2 305 V~

That will do :slight_smile:

jazzar:
I wanted to make ita biteasier forme on the PCB :wink:

I think a decent layout and labels there are a better idea :slight_smile: It also saves you time because Eagle can number it for you. For things like connectors and leds just give them a meaningful value instead of name. And when you have room on the PCB, you can print the values next to them because that's what really matters when assembling. Although I don't most of the time because it looks weird if I change the value when I build it. :roll_eyes: For example, 500R for a modern led is a lot of light and you might swap it for a 1k.

jazzar:
the connection between 11-12 is the off-state and 11-14 is the on-state.

Thanks for linking the datasheet! I must have been in real need of coffee... You are right. 12 is NC, 14 NO and you connected it to NO.

jazzar:
I've tried for several hours to get my BME280 working alongside the OLED but didn't succeed. as soon as the BME library was loaded the display would only show white noise. Maybe it was partly because a levelconverter was used with the BME, but since it has also SPI interface and I had enough pins to spare I used that instead.

Level converter should not matter but I suspect a bug (or just bad code :p) in the BME280 library :slight_smile: Or do they happen to have the same address on I2C?

"And when you have room on the PCB, you can print the values next to them because that's what really matters when assembling"
That does not look professional tho.
I just use Reference Designators( Name, in Eagle - R1, R2, C1, C2), and give them a Value ( both accessed by right-clicking on the part's Origin +).
Then you can select File:Export:Parts List and get a text file that has Ref, Des, Value, package type. Import that into an Excel spreadsheet and add in the Digikey/Mouser/other part numbers for ordering, etc.

Not a value in sight - just a few names for some of the LEDs and buttons, or perhaps Text added to the Top Layer of the board to show the function of an LED or a button or a header that you would interact with,

Great - someone just PM'd me, only IE11 is not showing anything to click in the big disappearing box at the top of the screen (nor on my smart phone) so I can't get to my messages. Guess it'll have to wait until I get home.

The other thing to do is Name all your signals. When you layout the board, you right click on a trace and see what it is.
You can then run an Error check on the schematic and on the board, lot more useful to see a real name vs N$57 for instance.
With later versions of Eagle (in 7.7 anyway) the names can also be seen on the trace when zoomed in some (how much depends on the trace width). Very handy for laying out critical traces when you don't want a long run or a lot if vias.
SCK for example, want it nice & clean, while Reset is not critical.

Don't forget Ground Planes too. Use the Polygon button draw a box around the whole PCB (if you have 120V AC, go around those traces). Right-click and Name it GND. Do that for top & bottom layer.
If you have to, add some Vias and Name them GND also to connect the top layer to the bottom. Then you don't need run traces for the ground connections. On my board, the lighter green is signal traces or ground plane, you can see some vias where the top ground plane connects to the bottom. Darker green is no trace or ground plane.

Holy, Now I know how you get that post count ::slight_smile:

CrossRoads:
Great - someone just PM'd me, only IE11 is not showing anything to click in the big disappearing box at the top of the screen (nor on my smart phone) so I can't get to my messages. Guess it'll have to wait until I get home.

Who uses IE 0:-) But damn, it's idiotic you can't open PM's from a mobile device... Still don't know if I like the new design. Does fix the "blind bar" problem but who needs all the menu items on a forum page anyway?

And yeah, like I said, don't print values component either except maybe for IC's. And for connecters, leds etc do because I use a name as value.

What would drive me crazy (and I think looks a unprofessional) is upside down labels ::slight_smile:

We're stuck with it, corporate thing with MS ties I guess.
I put the IC names near pin 1, oriented the same way as the chip, helps prevent hand assembly errors.
Works for us anyway.

Much information!

  1. changed Cap to 220uF

  2. Didn't know +5V connects directly while powering USB. I'm quite sure it isn't connected directly though. I once accidentally shorted a Nano between +5V and GND and something went up in smoke so something must be in between the USB and +5V pin.

  3. Code: It is actually neatly implemented in that it is reading all the switches into their corresponding variables within the loop... Hmm.. maybe I'll drop the resistors after all.

  4. MKP X2: This is actually not mains-paranoia. The alternative would be a 100N ~250V X2 for 0.06€ less. Ok maybe it is a bit mains paranoia.

  5. I moved to the board layout and it mecame quite unreadable, so component names were changed to classic abbreviations.

  6. BME280 vs. OLED: Code was fine (minimal working example) and commenting either BME or OLED made the other one work. I2C addresses were also checked...

  7. First draft of the PCB, as of now without ground planes. I plan on having it made by Seeedstudio (since they are so cheap). It's a lot of vias, but is there any reason not to use as many as I want? (other than neatness?) (Also: Names silkscreen etc. in a latrer step, I read what you wrote)

P.s. I found the correct molex connectors I plan to use

P.p.s. Thanks for the PCB walkthrough!

  1. You're right, not directly. There is a diode between them. That's partly the reason the "5V" is a bit low when connector to usb. You can find the schematic on the Nano board page

  2. It it's easy, give it a try :slight_smile:

  3. 250VAC is what I see most. And it should be fine. 230VAC nominal and most countries have max +5%. And even +10% is still kind of okay with 253V because the 250VAC caps are kind of designed for EU mains use. But a little bit more headroom for 6 cents doesn't hunt.

  4. Mm, one of the two libraries then must have a bug / code ugliness...

  5. As long as it's a non-critical signal (low current, low frequency, noise tolerant) I don't see any harm in the vias. But the connection to the first 4 Nano pins on the top row are ridiculous :wink: The Nano pads are on both sides, no need to make a via to bring them to them blue (is that top in Eagle?) side again.

And the component "RELAY", is that on the red (back?) with a reason?

And one critical point, you have more than enough board space. Keep the low voltage tracks away from the mains tracks. Like triple from what you did now at least. You have the space for it :slight_smile:

And you're not going to be happy with the SMD resistors between the connectors. Again, you have the space :slight_smile:

And why do use SMD resistors but use a through hole transistor?

Red is the top, blue is the bottom :slight_smile:

I'm planning to add the nano via female pin headers. I had assumed that if I order a pcb like this, DIP contacts will only be on one side. So all connections return to the bottom layer for their connections.

Hmm I really think I'm going to drop the external pulldowns. Also means I can downsize on the shielded wire. (Since the Grindermotor is only a few centimeters from everything) (Prototype here: Bezzera BB005TM 'Molto Bene' Edition )

The Relay component is an LED :slight_smile: (naming will update)

More tomorrow :slight_smile:

Seems like a sledgehammer to crack a nut - a simple 555 might do all you need...

Allan.

allanhurst:
Seems like a sledgehammer to crack a nut - a simple 555 might do all yoiu need...

Don't insult the coffee purists :smiley:

jazzar:
Red is the top, blue is the bottom :slight_smile:

Yeah, I'm a KiCad user :smiley: It also uses red for front but green for back.

jazzar:
I'm planning to add the nano via female pin headers. I had assumed that if I order a pcb like this, DIP contacts will only be on one side. So all connections return to the bottom layer for their connections.

Through hole connections are on both sides and platted through :slight_smile:

I also use Arduino's via headers on a lot of my PCB's. Mostly Pro Mini's though. They are just a bit smaller and cheaper 0:-)

jazzar:
Hmm I really think I'm going to drop the external pulldowns.

Also do proper debounce. That will also already help against noise.

And why not use a single cable for all switches? Or are they not close to each other? Then you just need a single 4-pin connector for all three.

jazzar:
The Relay component is an LED :slight_smile: (naming will update)

Yeah, figured that out. But you really want that on the back? (Just checking)

Ow, and one last thing. I've seen other Eagle users use the same footprint for the Nano. And it has the ISP header broken out. But you don't use it (I think) and you run wires straight though it. That you switch to the top makes of course no difference for though hole :wink: I would suggest just to edit the footprint and to remove the header.

allanhurst:
Seems like a sledgehammer to crack a nut - a simple 555 might do all you need...

Allan.

"need" won't create great projects :wink:

septillion:
Don't insult the coffee purists :smiley:
Yeah, I'm a KiCad user :smiley: It also uses red for front but green for back.
Through hole connections are on both sides and platted through :slight_smile:

I tried my luck with Kicad for a few minutes and decided I liked eagle better. Also it's nice to at least sometimes use a program everyone else uses :wink:
(Lyx ruined word forever...)

I get the feeling wiring will be much easier now...

septillion:
I also use Arduino's via headers on a lot of my PCB's. Mostly Pro Mini's though. They are just a bit smaller and cheaper 0:-)
Also do proper debounce. That will also already help against noise.

Noise is not that important, I use the simplest of debounces and most functions that are triggered by the buttons are either "hold-to-show-something" or enter a loop where input is ignored (e.g. grinding).
Relevant however is emf pickup, if I only use 2 wires to connect a button I could use a single stranded shielded wire like this: shielded wire I think there should be no difference in singal stability on using internal and external pullups but just want to double check. Internal pullups are a bit larger than 10k as far as I remember, so it might not be as stable hmmm..

septillion:
And why not use a single cable for all switches? Or are they not close to each other? Then you just need a single 4-pin connector for all three.
Yeah, figured that out. But you really want that on the back? (Just checking)

Buttons are apart from each other (or could be) depends on how you want to mount them in your grinder.

Wait, eagle tells me blue is bottom and red is top, so anything with red pads should be on the same side as the DIL components, so the LED would be on the same side as the relay and thus facing me. I'm confused...

SMD Resistor & Through-Hole Transistor: I looked for a transistor with a high enough power rating. SMD resistors are just because I think SMDs are fancy and I'd like to include some.

Update!

Rearranged the pins to make for a better Layout. Now get by with only one via, also looks a lot neater. I think it might be ready to start with the gerber file stuff :slight_smile:

Also: I tried to add slots instead of holes for the screws by adding a dimension layer in form of an oval. Is there some way I can back-check my gerber file to find out if everything is where it belongs?

P.s. I'm staying with the external pullups just to make sure the signal is very EM resistant.

After you create the gerbers (I use a .cam file from iteadstudio.com), you can look at the created files using a free viewer from viewplot.com.
Do you have ground planes also? Can't tell from what you've posted.
Make sure you have enough space between headers. Looks like you have friction lock headers? They need some space on the ends for the mating cable header, yours look a little tight.

I would also breakout the unused pins to holes, so you can connect stuff up later if you want (for another design or something).

Ground planes! Knew I forgot something!

Also checked dimensions of the connectors, tight fit but still within limits, also increased the spacing a little bit. Thanks for the tip with the breakout pads!

Soo... last chance to add features :slight_smile: however I cant really think of anything that's left to add.