# Marthos Brauduino - Another odd problem



## CosmicBertie (10/6/13)

Just done my first run with the Braudino, and I've noticed a few oddites:

1. When you set temperature steps (ie 55C 10mins, 68C 30mins), the timer starts at the beginning of the temperature ramp. I would've thought it would have started the timer when the specified temperature was reached? IE Ramp upto 68C, then wait for 30mins. This may be working as designed, I dont know.

2. After the last step, the unit signals to remove malt, which I did, then went to 'Boil' and the timer started for a 60min boil, even though the wort wasnt boiling. 

3. The unit never beeped for hop additions

I did flash the arduino with the software specified in my other thread, I dont know if that has the issues in it?

All a bit wierd. Anyone else had issues like this?


----------



## dmac80 (10/6/13)

Sounds like software mate. I'll have a look for the thread with your code in it


----------



## dmac80 (10/6/13)

The code linked in the thread looks good, the pump_rest function contains the code which compares the temp to the stage set point, and sets a tempReached boolean which, in turn, starts the timer.

Did you copy the whole code with no changes?

Cheers


----------



## CosmicBertie (10/6/13)

The only change I made was to change the name


----------



## matho (10/6/13)

definitely not how it is meant to work, sounds like you either have a problem with the code or you are getting a bad read on the ds18b20 every now or then. The first 2 problems could be a wrong read on the temperature sensor but the last problem is code, I fixed it about 3 commits ago.

View attachment brauduino2.txt


this is the latest code just change the .txt to .ino and you should be right.

If your still having problems with the timing of the stages then I would be checking the connections to the temperature probe as an open circuit on the data line will return a temp of over 4000, so if there is an intermittent open circuit then the timer will start to count down as soon as it sees the read. I have another version of the code that waits 3 seconds after a read at or above the set temp and then reads the temperature again, if its still over then it starts the countdown. I did this change to stop maloperation due to a wrong read but I haven't committed it yet as I haven't seen the need.

cheers steve


----------



## CosmicBertie (13/6/13)

Thanks for the code, I'll flash my unit again and see if it helps.


----------



## krasinet (22/7/13)

Hello matho,
excuse me for asking, but please tell me what to do with the file brauduino_eeprom.pde It uploaded to Arduino Uno with the help of Arduino IDE or what?
Best regards


----------



## Edak (22/7/13)

It's intended to set up the eeprom with suitable default values required by the main program, basically so that the defaults aren't all 255.

You upload it once before uploading the main program.


----------



## real_beer (27/7/13)

matho said:


> definitely not how it is meant to work, sounds like you either have a problem with the code or you are getting a bad read on the ds18b20 every now or then. The first 2 problems could be a wrong read on the temperature sensor but the last problem is code, I fixed it about 3 commits ago.
> 
> 
> 
> ...


 :icon_offtopic: Steve, is Martho your sister, or version 2 of the Brauduino?


----------



## roguenorman (29/7/13)

Hey guys, I too have made a brauduino from all the awesome info on the site. I also have the exact same issues as Cosmic Bertie. I suspect there is a lot of bad reads from the temp sensor because I can see the red light and "current temperature" contantly flickering and the "mash in" timer starts straight away. when it reaches the boil stage the pump starts to flick on and off too. after that it flicks on and off sporadically for a while then either the LCD spazes out or the temp throws a reading like 3033 or 2012 degrees (not over 4000) and the unit stops.

Also I have the pcb with the built in supressor and ive done the whole foil on the wire thing but it still makes the lcd go bad about 1/4 time the pump turns on/off. Matho, are you abe to post the code with the 3 sec. read time of the temp sensor? I think with that I can at least get the boil happening without the pump and element turning on and off randomly. The LCD thing I can look at after I get it whole thing working.


----------



## CosmicBertie (29/7/13)

I did another brew in mine yesterday, and its frustrating, to say the least. During the mash phase, everything works correctly when ramping to the appropriate temp, but the time starts straight away instead of once the temp is reached. So if I set the first stage at 68C, the timer will start straight away even though the heater is on and its ramping up the temp. 

the worse bit is when its boil time and like above, the heat/pump flicker constantly. Can hear the pump relay clicking like mad. Still no hop beeps either and the boil time starts straight away.

If its not a bug in the software, then im sure its the temp probe, but why it doesnt beep for the hops, i dont know.


----------



## djar007 (29/7/13)

I was under the impression that the pid settings control the ramping as it gets closer to the temp. Thus the flickering. I am going to hack the code to turn the pump off after about 85 as i wont really need it on and would like rest the pump during the boil. Pretty sure the pump turns off at 95. You guys may need to look at your pid settings.


----------



## roguenorman (2/8/13)

I think the pid settings are good. the flicking on and off of the pump/heater is too sporadic to be the pid. i have done some reading and it seems that the ds18b20 takes 750ms to do the read. I have the version that matho posted of the code that waits 3 seconds after a read at or above the set temp and then reads the temperature again, if its still over then it starts the countdown. this coupled with setting a delay of 800ms between the read and conversion has worked like a charm. ive attached the code. try that bertie and see if that makes a difference. I am still fiddling with the 2 delays as I have had the timer start prematurely about twice. 

View attachment brauduino2testwdelay.txt


----------



## roguenorman (3/8/13)

ok I found the problem. I had the data and ground wires the wrong way... its suprising that it actually worked with them wrong.


----------



## CosmicBertie (3/8/13)

roguenorman said:


> ok I found the problem. I had the data and ground wires the wrong way... its suprising that it actually worked with them wrong.


Hmmm...can you send a diagram of how you've wired it to the PCB?


----------



## Lance2 (3/8/13)

Hi I've added CRC checks to temperature readings. Can't figure out how to attach a file so here are the changes (based on comparison with brauduino2.txt posted by Matho in this thread 10th June):

Line 71: Change size of data from 2 to 9:
byte data[2];
byte data[9];

Line 213: Read 9 bytes instead of 2 and then do a crc check:
 for ( int i = 0; i < 2; i++) { // we need 2 bytes
data_ = ds.read();
}__
for ( int i = 0; i < 9; i++) { // we need 9 bytes
data = ds.read();
}

// if checksum fails start a new conversion right away
if ( OneWire::crc8(data, 8) != data[8]) {
ds.reset();
ds.skip();
ds.write(0x44,0);
Conv_start = true;
return;
}_


----------



## djar007 (3/8/13)

Hey cosmic I have a spare arduino with the right code if you want to borrow it to test


----------



## CosmicBertie (3/8/13)

Wooo, djar007 if you could do that, then i'll be able to tell whether its my board or my dodgy soldering


----------



## djar007 (3/8/13)

ok. i am back on thursday. Im not far from you so I will pm my number and organise a time and place. If you cant wait until then let me know and I will ask the boss to dig it out.


----------



## roguenorman (5/8/13)

here is how i wired it..


----------



## mattieharding (5/8/13)

Should be positive - data - ground

Well thats mine anyway


----------



## matho (5/8/13)

mattieharding said:


> Should be positive - data - ground
> 
> Well thats mine anyway


that is correct matt, it looks like the silkscreen formatting has got stuffed up and the terminal is not marked correctly. with the terminals facing you it should be + on the left data in the middle and ground on the right. I have a wiring diagram in the PDF's I made up that shows that.

cheers steve


----------



## matho (5/8/13)

hey roguenorman if your still getting the arduino glitching when the pump is being switched try putting a 16v 2200uF electrolytic cap across the 12v supply in terminals.

cheers steve


----------



## Deevotronics (14/8/13)

I downloaded the INO file in this thread, but when I compile I get the following errors. Havent tried loading it into the Arduino yet, my understanding of code is it should compile with no errors. Am I missing something?

brauduino2:28: error: 'OneWire' does not name a type
brauduino2:102: error: 'PID' does not name a type
brauduino2.ino: In function 'void Temperature()':
brauduino2:196: error: 'ds' was not declared in this scope
brauduino2.ino: In function 'void PID_HEAT()':
brauduino2:240: error: 'myPID' was not declared in this scope
brauduino2:244: error: 'myPID' was not declared in this scope
brauduino2.ino: In function 'void load_pid_settings()':
brauduino2:264: error: 'myPID' was not declared in this scope
brauduino2.ino: In function 'void setup()':
brauduino2:1011: error: 'myPID' was not declared in this scope
brauduino2:1011: error: 'AUTOMATIC' was not declared in this scope


----------



## QldKev (14/8/13)

Deevotronics said:


> I downloaded the INO file in this thread, but when I compile I get the following errors. Havent tried loading it into the Arduino yet, my understanding of code is it should compile with no errors. Am I missing something?
> 
> brauduino2:28: error: 'OneWire' does not name a type
> brauduino2:102: error: 'PID' does not name a type
> ...


http://aussiehomebrewer.com/topic/59563-mathos-controller/?p=963694


----------



## Deevotronics (14/8/13)

Excellent, works a treat. Thanks for the link QldKev. Cant wait to start brewing!


----------



## roguenorman (18/8/13)

hey mathos, thanks for the tip! it happens rarely now, but its when it does its a pain, so ill do that. I am using the code with the crc check and it is working really good now. the only thing that is weird is that it gets to the mash in temp, the timer starts right away, then after the mash in timer ends it then asks to add the malt. is that normal? I thought it would get to mash in temp, then ask for malt then begin the timer.

Bertie, how are you going with yours now?


----------



## matho (18/8/13)

roguenorman said:


> hey mathos, thanks for the tip! it happens rarely now, but its when it does its a pain, so ill do that. I am using the code with the crc check and it is working really good now. the only thing that is weird is that it gets to the mash in temp, the timer starts right away, then after the mash in timer ends it then asks to add the malt. is that normal? I thought it would get to mash in temp, then ask for malt then begin the timer.
> 
> Bertie, how are you going with yours now?


the mash in timing is there to allow for the temperature to equalise before calling for the malt, if you stop the heating when the temperature is reach you could get overshoot or undershoot, if you leave the pid going for a few minutes then it will be right on.

cheers steve


----------



## CosmicBertie (20/8/13)

Ok, I finally managed to get around to flashing my arduino with roguenormans version, and my tests show that its working better. 

So, I reckon its the temp probe which is throwing out spuriously high readings momentarily, causing the unit to switch off the pump and the heater as it thinks its hit the boil temp. This probably accounts for the boil timer to start straight away. Cant vouch for the hop beeper until I do a full brew, but hopefully that'll be at the weekend.

Fingers crossed.


----------



## gava (20/8/13)

When I was building my Brewtroller they use the same type of temp probes and I was getting weird error like what your talking about due to a dodgy temp probe.. I did make mine.. ended up buying a bulk lot off eBay no issue since.

-gav


----------



## roguenorman (21/8/13)

correct me if im wrong, but how the arduino works is it constantly cycles through the code. when introducing a delay, it affects the whole thing. When I had the 1 sec delay in the code, it made everything slow. it even made it slow to update the temp settings when I pushed the up arrow during a brew. Bertie, I have since reflashed my unit to the one that has the crc check, and its working the best. I want to try and get a little usb socket that I can put on my box so it can be flashed without unscrewing the box everytime. that or having 6 dupont wires hanging out that I can connect the programmer to when needed.


----------



## matho (21/8/13)

you are correct in saying that if you put a delay command in the loop then it will slow down the whole program that is why there is no delay put into the loop in the code, only for sensing button presses longer than 1 sec do I use a delay and then the delay is only when the button is actually pushed. If you want to slow down the read rate of the DS18B20 then I would the millis command and then perform a read after a set amount time has elapsed that way the code can continue to do other things whilst waiting for the time to elapse. If you are still having read issues I would replace the DS18B20 especially if you have connected it up incorrectly to start with.

cheers steve


----------



## booargy (21/8/13)

My temp reading is displaying zero. When I reverse the DS18B20 it reads 4095.75. i have changed the sensor 10 x and still the same? anyone have any idea what is wrong?


----------



## QldKev (22/8/13)

booargy said:


> My temp reading is displaying zero. When I reverse the DS18B20 it reads 4095.75. i have changed the sensor 10 x and still the same? anyone have any idea what is wrong?


What order do you have it connected.
I've recently found out, If you reverse polarity them they are stuffed on the spot, and if you reverse the data and neg leads you get a zero read but it does not blow the DS18B20.


----------



## booargy (22/8/13)

now it makes sense.
on my arduino board pins 10 and 11 are 100 ohms to ground. so it is always going to read zero.
looks like I need a new arduino.

cheers Kev.


----------



## booargy (22/8/13)

swapped the freetronics eleven for a mega. worked straight up.


----------



## CosmicBertie (22/8/13)

roguenorman said:


> correct me if im wrong, but how the arduino works is it constantly cycles through the code. when introducing a delay, it affects the whole thing. When I had the 1 sec delay in the code, it made everything slow. it even made it slow to update the temp settings when I pushed the up arrow during a brew. Bertie, I have since reflashed my unit to the one that has the crc check, and its working the best. I want to try and get a little usb socket that I can put on my box so it can be flashed without unscrewing the box everytime. that or having 6 dupont wires hanging out that I can connect the programmer to when needed.


So which version of the code are we using now, Roguey? :-D


----------



## QldKev (22/8/13)

booargy said:


> now it makes sense.
> on my arduino board pins 10 and 11 are 100 ohms to ground. so it is always going to read zero.
> looks like I need a new arduino.
> 
> cheers Kev.


To add to my statement,
I've recently found out, If you reverse polarity the DS18B20 the DS18B20 are stuffed on the spot, and if you reverse the data and neg leads you get a zero read but it does not blow the DS18B20.


----------



## roguenorman (26/8/13)

Lance2 said:


> Hi I've added CRC checks to temperature readings. Can't figure out how to attach a file so here are the changes (based on comparison with brauduino2.txt posted by Matho in this thread 10th June):
> 
> Line 71: Change size of data from 2 to 9:
> byte data[2];
> ...


_I added this to mathos original code and thats what I am using currently. I just did a brew with it on the weekend and it was good. not 1 bad read. Here is the code. 

View attachment braduino2crc.txt
_


----------



## CosmicBertie (3/9/13)

I've tried the code you've attached, and I'm getting better results. The mash was good, no bad reads, timers seem to be more stable. The boil was better, no flickering/clicking of relay, and the boil timer seemed better. However, I still didnt get any beep alerts for adding hops!

Confused.


----------

