PDA

View Full Version : Menu building



Amoque
- 4th January 2018, 01:45
I hope the new year finds everyone well.

I'm looking for strategy rather than programming help and I hope experience or a clever approach can simplify what has turned into an arduous task. I am building a controller for my aquarium; the first was successful, but new skills motivate me to improve and, well... new features mean complexity.

In a nutshell, I'm looking for an efficient menu system - a way to set ON and OFF times of lighting, set days of the week that dosing pumps dose, adjust temperature... such as that. On my previous attempt I used 2 methods: a 3 button matrix and a serial connection. The 3 buttons where quick - emergency or simple settings. The serial connection allowed for command line entry and entering multiple parameters when required. Both systems had their drawbacks - the buttons required shuffling through sub-menu after sub-menu; the serial required that I retrieve my laptop...

I have begun a compromise using an old SONY remote; it works, but I'm not satisfied - buttons are not correctly labeled and shuffling values, strings, DATA and READ statements is tedious beyond endurance. I need to control about a half dozen devices and likely have 3 or 5 mixed WORD and BYTE values to manipulate per device [I.E. an RTC - 6 registers of time, alarms, day and date; 3 12V dosing pumps BYTE days of operation WORD start time WORD duration; 8 plug relay board...]

I'd ask the group - do you know or have you used something better/ easier/ you'd recommend to a beginner? Perhaps I'm simply approaching this wrong and there are ways (using extended EEPROM, an encoder, or some other "trick or tool" to make this simpler) to minimize or organize my efforts? Maybe the ideal way is Wi-Fi or an Android module and my phone? I'm just finding my PicBasic legs and don't really want to start off in some unsupported direction based on a sales pitch.

Any advice?

pedja089
- 4th January 2018, 12:51
I would use touch screen or bluetooth + App on phone. I don't have experience with WIFI, so...

Ioannis
- 4th January 2018, 14:04
Maybe a Nextium LCD that works as an HMI?

Ioannis

Amoque
- 4th January 2018, 14:13
I am leaning toward a Bluetooth module... as you suggest. I see here (in the forum) there are some discussed, but I know next to nothing for myself. If anyone has an example, a recommendation - or can point to one... or an alternative... I'd appreciate hearing about it.

As always, thank you.

Amoque

Demon
- 4th January 2018, 17:36
Here's a challenging option:

Use an old cell (or even your personal cell) that has android 4 or higher (I think you need that to interface).

Pick an android BASIC of your choice, and use that as a remote., interfacing via bluetooth to your PIC.

No need for displays or controllers, your cell acts as an all-in-one, except for the need for a IC that can receive bluetooth, or using a bluetooth interface chip.

That's how I would do things today.

Robert
:)


EDIT: Level 2 challenge:

Interface via the interwebs so you can change stuff and monitor at will from anywhere.

Demon
- 4th January 2018, 17:42
...Maybe the ideal way is Wi-Fi or an Android module and my phone?...

I had missed that. This is the future, at least for quite some time.

Your phone, android BASIC of your choice (some are free), I had forgot about WIFI, and you need a chip to process bluetooth or wifi, or a PIC that supports these features.

There has to be samples out there on google. I have yet to embark on this adventure, but it's where I will go one day soon.

Robert

Dave
- 4th January 2018, 20:21
Amoque, What is, or what are the devices you are setting the on/off/day commands to? I personally have had good experiences using one of the ESP8266 devices with ESPBASIC. That way you can have a WIFI interface to your device. You can set up the web interface with buttons and switches as well as sliders for variable data. ESPBASIC is free and the devices I have used are the ESP8266-1 512k and the LOLIN 4M modules.

mpgmike
- 5th January 2018, 00:37
I'll start where Dave led us and raise a few more questions. I create controllers for other people. I ask lots of questions about what they are attempting to accomplish. What determines whether you want a light on or off? What determines whether you want a pump on or off? Is there a target for an analog (PWM) variable output? Many times, the whole process can be automated with absolutely no user input based solely on desired results. Knowing what determines whether a given output should be "1" or "0" (ON or OFF) inspires the addition of an input the PIC can use to make the decision automatically. If you are looking for random changes in outputs, switches and/or pots can generate simple inputs.

If you could show us an algorithm (flow chart) that describes the ideal scenario, a better solution may become blatantly obvious.

Amoque
- 6th January 2018, 16:06
Amoque, What is, or what are the devices you are setting the on/off/day commands to? I personally have had good experiences using one of the ESP8266 devices with ESPBASIC. That way you can have a WIFI interface to your device. You can set up the web interface with buttons and switches as well as sliders for variable data. ESPBASIC is free and the devices I have used are the ESP8266-1 512k and the LOLIN 4M modules.

I have/ am looking at the BASIC ESP modules, but I hesitate to get bogged down with a learning curve - my community of fish are greatly inconvenienced by my lack of knowledge. That said, I am reading up and will leave room for expansion or modification perhaps on a second build or as a wireless serial option. My efforts were an engaging project as a beginner and replacing commercial products with my own was exciting, but I have now come to rely on it and in doing so, I have come to the realization of a significant difference between hobbyist and professional - reliability, reparability, and responsibility. Another lesson learned.

For now, I think I'll reuse the serial code I used previously to set the clock, set the pattern of the lights, adjust temperature, dose supplements, and other such mundane tasks as distract from my enjoyment of the hobby. It's not so difficult, one of the Chinese 8 relay boards handles the 110V and, other than that there are only five 12V sockets (3 populated with dosing pumps), some status LEDs, and an I2C OLED for output. Input is a few ADC channels, a flow meter, and 3 buttons - and a venerable, but reliable serial channel for communications.

Each device has its own identifier, device 1 is an RTC, 2 is a light, 3 is a dosing pump, 4 is a heater, 5 is a "top-off" pump... I use a generic string to code/transfer values to read and write values to and from EEPROM. These values are read periodically (once per minute) to control the individual components.

Last, in regard to the suggestion for Wi-Fi. I think it would be convenient to use a well designed visual interface for monitoring (especially) and control, but mostly this my need is limited to occasionally adjusting the clock, or reducing the dosage of this or increasing the dosage of that... What I would much appreciate is - eventually - a web camera so that I could watch them from afar!

Amoque
- 6th January 2018, 16:17
I'll start where Dave led us and raise a few more questions. I create controllers for other people. I ask lots of questions about what they are attempting to accomplish. What determines whether you want a light on or off? What determines whether you want a pump on or off? Is there a target for an analog (PWM) variable output? Many times, the whole process can be automated with absolutely no user input based solely on desired results. Knowing what determines whether a given output should be "1" or "0" (ON or OFF) inspires the addition of an input the PIC can use to make the decision automatically. If you are looking for random changes in outputs, switches and/or pots can generate simple inputs.

If you could show us an algorithm (flow chart) that describes the ideal scenario, a better solution may become blatantly obvious.

You are correct and what you suggest is exactly my strategy. However, it is necessary to have simple means to correct in response to unforeseen circumstances. I often will cancel dosing when I am on vacation, or in response to algae growth. I would guess that 75 - 90% of what I rely on the controller to do is automated. These are time based and there is little logic else to consider.

I monitor certain basic functions - temperature, water level and flow, and light level (the florescent bulbs I use degrade in output over time). I also track the lifespan of my U/V system, but most of these are alarms or indicator type lights and are not complicated function type decision makers. I suspect if one had several tanks or, if one were far more advanced in knowledge of programming... Besides, I rather enjoy "getting my sleeves wet" and only for the safety and security of my tenants am I mostly concerned.