Happy new year everyone!
I posted on here a while back about an espresso machine I was building. I'm nearing the end of the project, but I have a few kinks that need to be worked out.
The first issue is related to the PID for the boiler. I have a temperature sensor, a small relay board, and then the super beefy relay (which must be controlled by the small relay since it uses 12v). When I have everything wired up and I turn on the machine, the boiler always turns on, and stays on, no matter the temperature. This is not related tot he temperature sensor, since I have had the machine print the current temp. However (this is the weird part), if I turn off the machine, and plug in my computer, I get just enough juice to power the LCD, arduino, small relay board, and various other sensors, and the PID will work! I have gotten the water temp way above the max value, then turned off the machine and plugged it into the computer, and the relay will switch off! Then, if I wait long enough for the water to cool bellow the min, the relay switches on! This seems more hardware related than programming related, but I can attach my sketch if needed.
The second issue is with the fill sensors for the boiler. There are 3 prongs that submerged at different levels into the boiler. These prongs are connected to a board which allows me to get a HIGH/LOW signal based on water level. The arduino then decides to switch on/off a relay which controls a small fill pump. However, like the PID, this only works when powered by the computer! If I power the machine from the outlet, the fill pump will turn on and never turn off.
Post your code, but especially post a detailed schematic. It may be as simple as a grounding issue that is resolved when the board is grounded through your computer, or it might be a difficult relationship between the code and wiring. Hard to tell without seeing either.
Aha! Now I recall (It has been a while since I've worked with the machine, I was away for a while), I also had to unplug the main grnd before plugging into the computer, otherwise my relays click on and off erratically. I will revisit my wiring tonight, if I don't sort it out, I'll post the code and wiring schematic.
Ok, so I basically ripped the machine apart, and have begun soldering everything to a board for final assembly. However, I think I'm still having issues with at least the 'filling' component. I haven't been able to test the boiler component yet. Here is the link to my code, and I will try to bang out a detailed schematic tonight.
OH and I almost forgot, when I found a code for reading a thermistor, it had a component in it where "analogReference(EXTERNAL);". Now, if I implement this in my code, it screws everything up, so I currently have // in front of it, but I'm assuming the thermistor won't work unless this is used?
fancycoconut:
OH and I almost forgot, when I found a code for reading a thermistor, it had a component in it where "analogReference(EXTERNAL);". Now, if I implement this in my code, it screws everything up, so I currently have // in front of it, but I'm assuming the thermistor won't work unless this is used?
The analog converter works by comparing an input voltage to a reference voltage. If the input voltage is zero, it returns zero. If the input voltage is the same as or higher than the reference voltage, it returns 1023. Anywhere in between, it returns a proportional number.
But what is the reference voltage? Normally, it's generated internally to the processor, and is whatever the supply voltage is, like 5V. But you can also enable an external reference voltage, in which case the reference is whatever you are feeding into the AREF pin.
That line of code is selecting the external voltage reference. If you don't have an external voltage supplied to the AREF pin, you won't get a valid reading. Did that code sample include a schematic? If so, what does it have connected to the AREF pin?
If you leave that line of code out, you will be using the internal 5V reference. Things will still work, but you might not get the full range of 0 to 1023 if the thermistor is hooked up to a different voltage source. For example, if the thermistor is referenced to 3.3 volts, and you are using a 5V reference, the largest value you will get from analogRead() is about 675.