Coding – Basic Electronics
I hate coding, plain and simple. I work in IT as a Network Manager and even though we use alot of scripting for Windows, code has never interested me and I find it very boring!
Sadly for this project I would need some!
I settled on an Arduino for this as there are plenty of code examples out there for help, relays are easy to come buy for them and I wouldn’t want to over complicate things with a PC or Raspberry Pi doing the background stuff.
I first decided what I wanted it to do before starting to look around
- A clear display and counters
- Several relays, servo to be controlled by time or button press
- Automation of the above
- A basic brains for the project
I bought a normal Arduino Uno to play about with. I will be using a Mega 2560 for the actual project as I need alot more input/outputs for the relays, lights temp etc.
As I’ve never used one before, I started to have a play with basics first, like getting the display working
First things first, lets try and give it a name!, Just playing about, learning how to change text lines, change and update text using the code correctly.
I then proceeded to have a play with the relay, I bought two 8 channel ones off ebay. Just simple stuff like turning them on and off for certain times etc. These will be used for switching on relays, pump etc to fill and drain tanks.
I soon swapped to a bigger LCD screen with 4 display lines as I soon found out that 2 lines wouldn’t display all the infomation I wanted.
Got a bit stuck….
The only real brick wall I hit was timing for the Agitation. I intend to use a relay to activate a servo for ‘twiddle’ agitation, this required a normal countdown, whilst activating the relay at regular times during this countdown.
You can’t use the normal ‘Delay’ code for this and you need a ‘millis(); ‘ function. After spending nearly 10 hours continuously on this I was stuck. The arduino forum people must be sick of people asking about this as theres a whole thread dedicated to it. I don’t think they realise non-coders simply can’t get their heads around it. I can’t.
In the end, I put out a advert asking for some code in return for some lunch money. In the end a cool guy from India charged me £20 to do it. I felt this was fair and the next day I had the code which I could now understand and edit for all the parts I needed.
Being someone that likes to do everything myself I was a bit apprehensive at doing this at first but it worked out well, and would have took me days and would have probably made me lose a bit morale for the project if I had not got it done.
I then built a quick button test bed. The idea I have is that I want to press a button for example, to select ‘C41’, then the screen will explain what to do before asking me to press the ‘GO’ button. I plan on using some cool light up buttons so want to make sure they light at the right time etc.
I had originally the idea of pinching the Filmomat’s idea of using a scroll wheel, but after seeing the coding required for even a basic menu using a wheel, and liking pretty buttons, I scrapped this idea. I want the project to stay simple and scroll wheels make the code horrendous.
With all the play over, I then set to work tidying my code, sorting into the Initial run stuff, Program examples for different cycles and proecesses. This means when I’ve actually built the machine, I can just copy and paste my code and adjust the timings for tank fills, agitations etc. without having to write anything from scratch.
The coding has now been put to the back of the shelf (so to speak) as I concentrate now on starting to get parts for the actual machine build. I will be revisiting the code one I have the physical machine built.
When the machine is eventually finished, I’ll be releasing the code and some basic plans if you don’t want to go through the sometimes painfull process of learning coding. You will need to have a basic understanding though, as even with copy and paste you might have to change the odd thing to fit your needs.