File component issue (Using Bluetooth, TinyDB to control a Plant watering system)

P.S. Ths is just the first two rows there are 7 in all I just did the first two to test it to see if I could get it to work.

See this topic

The requirement is different, but it shows how you move from a "linear" procedure (as per your current blocks which just races through to the end) to a looping procedure, using a clock timer to effect the loop, which waits until each activity has finished before the next is started.

Can't stop my Illustrator CS5 from wanting to load it. Any other suggestions

Does your application control live relays? Works like a microcontroller? The loop must pass between the seven "Duration" fields and periodically turn the relay on and off? Does it do that all day?
It wouldn't be a better solution if the relays were to be controlled by a microcontroller, while the application would be used to configure the microcontroller?

This program writes and reads data from fourteen text boxes using the clock component. There are also defaults on first run. Maybe this will bring you closer to how the clock works.

clock.aia (4.6 KB)

Hi Parryk

No it does ot.

The application requires the AC pump to be turned on for 15-20 seconds. Then off for 10-15 minutes to allow feed water to soak into soil. Then on for 15-20 seconds. Then off again for 10-15 minutes again to allow feed water to soak in. This is repeat 3-4 times until the plant receive approx. 3/4 of a gallon of feed water. The process is repeated ever 3-4 days by user.

Also Patryk
the plants may require different watering timing based on pot size and type of plant and whether they are feeding the plant or Flushing them.

I'm not asking that. Do You need an application for the pump and other devices to work all the time? Is she just configuring a device? What is the heart of your system?

Does the app on the phone control it all the time? Do you have any microcontroller, e.g. arduino?

This is a complete control system that will be controlling 9 water control valves, 110AC pump to supply both feed water and just plain osmosis water to flush out nutrients, Monitoring Ph levels in soil, Mixing nutrients for feeding automatically and controlling a mixer to keep feed water mixed. to start with. All controlled through a bluetooth app that she can use while sitting at the dining room table or watching tv. I thought about a micro-controller but I think one 16 Channel Bluetooth relay board will do everything that needs to be done.

Eventually I might want to go WIFI with it but for now just Bluetooth.

The only difference is that you must remember about the application and you must be at home to turn on the system. However, the microcontroller would control everything automatically. No household interference.

But now I get it. Tomorrow I will show you an easy way to countdown time.

Ya you know what Patryk. Early on, on another project I bought the emulator, Bluetooth modules, Ph sensors etc fully intending on doing just that from MIKROE. But once they came out with Bluetooth boards I found it easier to just use them and a phone app to do the same thing by eliminating the redundant interface. ,I've done two applications this way both seem to do the job. One with just a 2 channel relay board and one with an 8 channel which really came out nice.

I am absolutely digging the MIT APP INVENTOR Development system and tell everyone I know about you guys.

Thank you for the help Patryk

Hello Jay

I think I remember Trailer Mate from the old App Inventor Forum :grin:

Yes that was two years ago. I was just getting into phone apps back then. The Trailer Mate was my second project using Bluetooth. That was a project that was self contained. Ran off a battery. Replaced the jack on the camper and allowed you to drive the camper around without the need of a vehicle attached.

Sweet project. Lifts the tongue up to 3,500 lbs., goes forward/reverse and left/right using your phone. Can pull a 10,000 lb. camper.

Trying to get that out on the market later this year. Had some delays because of COVID.

You used 7 fields in your application. does that mean the user can make a maximum of 7 on and off combinations? But it can also do less? Then will the blanks be left out? What do you enter in the On / OFF fields? If the inscriptions "on" and "off", isn't it better to use "switch" components that will represent on or off?
Sorry for so many questions, but they will allow me to better understand the application to apply the best solution. Maybe they can help you improve the app.

No problem Patryk I appreciate the help.

  1. Yes 1 cycle will consist of the Relay "ON/OFF" or if it makes more sense "ON" for a specified number of seconds by the user. The Unit will then for a specified "DURATION" in second the relay would be "OFF". That would be one complete cycle.
  2. They have the option of setting up a total of 7 cycles.
  3. If the "ON/OFF" cycle is Blank then that cycle and all cycle after that will not be performed.

Does that make more sense Patryk? Maybe I should change the headers to "ON" and "OFF" instead of "ON/OFF" and "DURATION" that might make more sense. What do you think?

And maybe we could post part of this as a TUTORIAL if we submit a version with or without the Bluetooth! What do you think?

I made an example of an application that allows you to add an unlimited number of ON / OFF tasks. The app will use the ListView component instead of the text boxes. You can add, delete or modify tasks. You can save / load the list. After clicking on start, ON or OFF strings are sent by BLE at a specified time.

clock (4).aia (195.7 KB)

1 Like

Thank You Patryk

Please give me a couple of days to check it out. Sounds very versatile. I have zapped the DSD tech board that I have been using. It's a few years old and finally gave out. I have ordered a couple of new ones they will be here the 24th.

Hi Patryk

I recieved the newDSD Tech board today and had a chance to try out your version of the clock.aia It connects to the board, I can set the different on off times, when I press START it runs through the list. Doesn't turn the relay On or Off but I think is't just because I am not sending the code to do that.

I appreciate all the help. Is it possible we could work on the version I have created. I kind of has my signature design of the way my apps look and feel. I would like to keep my design layouts the same for all the products I produce. I hope you understand. I feel that what I have programmed is pretty close to working but I am missing something. The fact that it drops through the btn_start but is turning the relay on and off without using the textbox info tells me I am on the right track.

I hope you can understand where I am coming from. Again thank you for your help

My version sends the text string ON or OFF via BLE. I don't know what your version sends, you need to customize the text sent.

Hi Patruk

My version also sends a custom string using the procedures. I can visually see and hear the relay turn on and off but the routine drops through the entire btn_Start routine ignoring the times that where entered in the text boxes. The relay is turning on and off so I know it sees that portion and send a signal to the relay board to turn the relay on and off. At the last time that is set in the routines last text box with timing information set in it, it cycles through the time that is set because I print the information in a LABEL which displays the time as it counts down. called lbl_TimeStatus.text (Lower left corner across from start button). But it only shows the count down time that is set in the last Text Box which has valid time set in it.

RelayOn and RelayOff

The other portion which I haven't shown allows the user to enter plant names and choices for "feeding", watering" and "flushing" they can enter what ever timing values needed for different plants and in the areas "feeding" "watering' or "flushing'. that information is stored in separate files for each plant and the process that is being executed i.e. "feeding", "watering" or "flushing". The two list boxes labeled "Plant Type" and "Water Mode" are combined to create the File name to save timing information..

I hope I have provided enough information for you to get a clearer understanding of what I am trying to do. If you need more Please Patryk let me know.

Thank you so much for your help.