Help Needed On Creating an Spark App for Artificial Pancreas

Few things up front regarding the whole ‘app’ idea; Making an iOS app is no trivial task, moreover, it’ll cost you at least $99/year for a developers licence, not to mention the fact that you need an Apple computer for Xcode. And that doesn’t even include the fact that you need to know how to actually use said software, and the fact that you’ll have to learn how to program that in less than a week or so. You’ll also need some kind of server to log your data when you’re not using the app.
The webapp is less difficult in the way that it doesn’t have any software requirements or mandatory fees. It will also run on all platforms. The problem here however lies in the fact that you’ll need a place to host that page on, and some kind of server which continuously logs your data.
The server side could be done with node.js, but you’ll need a place to host that on as well. If you’ve got a raspberry pi, or some other device that’s permanently connected, you could use that, otherwise you’ll have to find an external host for that as well. Also, you’ll need to code the necessary node.js code (javascript, which could fortunately be the same as the webapp).

Considering all of the above, the time constraints, and your (lack of) programming skills, I would highly recommend checking out one of the online options I mentioned in my previous post. They are capable of running on all platforms (it’s webbased), they have datastorage included, they have hosting included, they have data visualisation included. That pretty much sums up all of your requirements. There’s some sort of proverb about wheels, and the fact that you may not want to reinvent them. I’ve got a hunch that might be applicable here ;).

The other concern is the available data. Unless you’re going to stick in a PH sensor, there’s hardly a way of telling the PH values at any given time. Seeing as PH sensors are rather expensive and cumbersome so set up, I think I may have an alternative. What if, instead if measuring the PH value, you measure the flow rate, and use that to calculate the PH values (approximately). It should be basic chemistry that when you mix X amount of Basic stuff with Y amount of acidic stuff, you get a PH of Z. If you know how much acid you’ve got, and you can measure the amount of basic stuff that’s being pumped into it, you not only have the total amount of combined liquid, but are also able to calculate the PH values. You can use one of these flow meters to measure the amount of liquid that’s being pumped. I can’t guarantee that’s it’s going to be incredibly accurate, but then again, a home-made copper conductivity sensor, orange juice, and baking soda probably isn’t going to be that accurate either :wink:

Maybe there are some alternative ways of measuring the output of your circuit (voltages, current, resistance of conductivity sensor), but I feel more comfortable asking @bko or perhaps @kennethlimcp for some ideas regarding that.


Unrelated side note: in the future, please don’t edit your posts so dramatically. It’s going to be confusing for other readers when the responses don’t match up with the post being responded to. Most of the question in my first post have now been erased from your original post, which is kind of messy. If you feel like adding additional information, just put it at the bottom of the post, preceded by “Edit:”. That’ll make it easier to understand. Thanks in advance!


@kennethlimcp, I’m not sure where you’ve seen that he’s using an Arduino, because it looked all analog to me(?)

2 Likes

@Moors7, I believe the “pH” sensor in the article is actually a conductivity sensor. Generally, pH and conductivity are related under controlled conditions. For this project, that type of sensor vs an expensive pH level sensor is probably fine.

So, the conductivity sensor is used to trigger a MOSFET switch to turn on and off the pump. The same approach may be feasible with the Core but the “sensor” would need to be characterized. That is, what voltage/current range does it produce so it can be correctly read with the Core. This is great for pH thresholds but not for actual values which like I said before is probably fine for this project.

To read actual pH requires a specialized probe and amplifier which I believe may be beyond the range of @benclough’s budget. Instead of biting off more than he can chew, the project would be a great demonstrator if he got the sensor and the Core working together along with sending data to a Google spreadsheet for example or using IFTTT for triggering an alarm. Keep it simple and leverage existing tools so he can build it quickly and make it look great :smile:

3 Likes

Thanks for your input and the advice :smile:


@peekay123, A pH sensor would not be a conductivity sensor. It would be something to measure the acidity of a substance. Sorry for any confusion caused,


But can I use the Spark Core? Sorry I am new to this kind of stuff...


Does flow rate mean the pumping activity over time? Also I am sorry, I can't understand your alternative...:frowning:


@kennethlimcp

I don't know what you mean by the use of Arduino.. I haven't used a Arduino yet........


@peekay123 I am confused how the Core and Google Spreadsheet work together.Also, what is IFTTT?

Thanks for your input :smile: :blush:

@peekay123 Unfortunately this is not the case for me. I am still confident that help with such a wonderful community is enough !!

@peekay123 Can you elaborate on each of these please? Mostly the first one

@benclough, the article you pointed to refers to using a conductivity sensors to sense the level of pH in a solution. Conductivity and pH are related under controlled conditions. In the article, the conductivity sensor will trigger the pump when the solution’s conductivity/pH is high enough. For your project, this may be enough to demonstrate the idea. Instead of driving pump, the Core could read the voltage/current through the conductivity sensor (the wires around the blue tube) and act accordingly. For your project, the Spark Core could:

  1. Read the conductivity sensor’s “output” and log it (this may be very basic like high/low since it is not a real pH sensor)
  2. Control the pump based on the sensor’s value
  3. Send data to an internet service like Google Spreadsheet or IFTTT

One of the powerful aspects of the Spark Core is its ability to connect via WiFi and the internet. You can use that to send data to a Google Spreadsheet or use IFTTT (IF That Then This) which is like having a program make decisions on what to do based on defined conditions. The cool thing about IFTTT (which is a free web service), is that you can define “actions” like sending a tweet or a facebook post or send an email or many other things.

The Spark Core gives you a processor to read, calculate and react by using a C++ program AND provides a connection to the internet to enable you to take advantage of a huge number of “services” there. :smile:

2 Likes

@benclough, if you have never programmed or used an Arduino before, using the Spark Core may present a steep learning curve. This community is extremely helpful but it would be best if you had someone with programming experience in Arduino to help you locally. Then we can guide the two of you. :smile:

2 Likes

You most definitely can, you just need to differentiate between the sender and the receiver. The sender would in this case be the Spark Core, which can broadcast your data to the internet, whereas the receiving end would collect said data and possibly visualise it.

A flow meter measures the amount of liquid passing through it, allowing you to determine how much liquid is being mixed. Using basic-acid chemistry, you should be able to figure out the PH values depending on the amounts used.

Your Core would expose your measures values to the internet, and Google spreadsheet would pick these up. There's also a built in functionality which you can use to make line graphs. If you check out the topic I linked to above, you can find some nice example where people used Google spreadsheets to store/visualise their data.

1 Like

Hey,
I was looking at the size of the Spark Core and I am anxious if the Spark Core is too big for my breadboard…

I have a 400 point solderless breadboard, and want to know if the Spark Core can fit on there?

Don’t worry, it’ll fit :wink:

1 Like

Thanks!!

Also where should I start? I have got so much information, I don’t know where to start? What application will I be using and which coding language is it?

I have a few more questions in mind.
Does the Spark Core have to be connected to the Internet? I am going to present my science fair at a school, and we may not have Wi-Fi there.
Does the model always have to be in the baking soda and orange juice? As the school is far away from my home, I wanted to know if the how the flow meter works and if they always have to be connected to the baking soda. I will disconnect the pump on the car ride to the competition and will connect it together with the flow meter and baking soda at the competition. Is this okay?
Next, How does the flow meter work? Where should I connect this meter to?
Next, so as the judges come by, I will submerge the conductivity sensor into the acid( Orange Juice), and would like to know if as soon as I submerge, will the Spark Core begin sending data to the web application as the pump starts pumping baking soda into the orange juice?
Where do I plug the other end of the Spark Cable? Does the Spark Core need to be charged?

If you're sure you're going to use the Spark Core, then get your hands on that as soon as possible. Even if you're not going to use it for this project, it's really awesome, and definitely worthwhile!

The application for coding the firmware for the Core will most likely be the online IDE. Like the main page says, It makes use of the Wiring language, which is the same as Arduino uses. This makes it easy to find examples. It can also work with C/C++ if I'm not mistaken.
The Google spreadsheets part will work with their software, which looks a lot like JavaScript (haven't really looked into it yet). Depending on how difficult you want to make things on yourself, the examples provided in the topic I linked to, will suffice.

The Core itself will be able to work without an internet connection. You will however not be able to use its network functionalities. That means you won't be able to send information to the internet, nor will you be able to control it over the web. If you can bring a wireless router, that might be best, since then you'll be able to create your own network. Another possibility is to use a mobile hotspot. Most mobile phones nowadays are capable of sharing their internet connections by creating a hotspot. You can most likely use that to connect your Core to the internet.

I'm not sure what you mean by 'model', but the Core goes on the breadboard. Since it'll get it's measurements from there as well, it should work as long as the rest works.

Honestly, I would ditch the idea of the flow meter. It was just one of many possibilities, but @peekay123 's suggestion is much neater, and should be preferred.

That's up to you to code. The Core is as brilliant as it is dumb. It can do a lot of things, but only the things you tell it to do. If you don't tell it to measure things, it won't measure things. If you don't tell it to send data, it won't. Turning on when you want it to definitely belongs to the possibilities.

The Core can be powered over micro USB using pretty much any USB adapter that provides 5V, 300+mA, preferably 500+mA. The Core itself can not be charged, since it's doesn't contain a battery. Although it's possible to use an external battery pack (those cell phone back-up batteries), it might drain those rather fast, depending on the capacity. You can even make it run of normal batteries, but I'd suggest you stick with the USB powered micro USB cable.


@peekay123 mentioned this already, but I'll repeat it just to be sure. Coding stuff, and making projects like this can be, and often is, a lot of fun. When you've never done so before, and you're under time pressure it can become rather stressful. Is there anybody you could ask to help/assist you, preferably with some experience with things like these? If so, then please do ask for help, since it will save you a tremendous amount of problems.

1 Like

@benclough, I think you need to find someone who can help you locally and with Arduino experience. Otherwise, we will not be able to help you much more.

3 Likes

@benclough, IF you are using a Spark Core to read the conductivity sensor and control your pump then you could measure:

  1. The conductivity of the solution (from the sensor) as it relates to pH
  2. The amount of time the pump is on or off - knowing what the flowrate of the pump is (milliliters per minute or hour), you could estimate total liquid volume pumped.

@benclough, a lot of your questions suggest that you are biting off much more than you can chew here. You really need a coach/mentor who has experience with micro-controllers before you can go any further. Without wanting to be rude, I cannot not help you any further until that happens. :smile:

2 Likes

I have a group of people who can help me with building the Spark Core with group. What bothers me is the fact that they have the same question:

How does this work: Can you elaborate more?

It would be really helpful if you answer this final question. It would be considered with appreciation :smile:
@Moors7
Final question before I wrap up this forum, How could I connect this idea of @peekay123 with Google Spreadsheets?

Also can @Moors7 look into the Google Spreadsheets and explain the idea in simple terms? I saw the Google spreadsheets Idea and there is code, can I use the excat code?

@benclough, if your support group is asking the same questions then they may not have the knowledge required to use the Core. Do they have Arduino experience?

As for logging to google spreadsheets:

2 Likes

I don’t want to crush your dreams or anything, but I have to agree with @peekay123 on this one. If none of the people in your group can answer even these questions, then it’s highly unlikely that you’re going to get this working. You need someone with experience locally to help you. If that person can’t answer these questions, then they’re not the right person. If you don’t understand the Spark specific stuff, that’s understandable, but you’re asking for basic electronics, and basic programming. Those two things you should know before starting, or have someone there to help you, who does know.

Of course we can keep answering all your questions here, like we’ve been doing so far, but until you get someone with experience, that’s not going to help.

I could go though the Google Spreadsheet topic and tell you how it works. But I’m not going to do that for several reasons:

  • It isn’t my project. Although I’d gladly help you, I’m not going to make it for you, nor is it likely someone else will. This forum is for helping each other out, not for doing each others work. If you’ve got some specific questions like:“I don’t understand this particular piece of code, could you explain it?”, that might be okay. Now it’s more like:“tell me how to do everything”, which is, unfortunately, not okay.
  • The Spark Core is a ‘development kit’, something you use for developing things. It’s not a Lego building kit with a guide that tells you where to put what item. You’re going to have to figure stuff out on your own.
  • I personally feel like you aren’t putting in as much effort as you’re expecting us to put in for you. The Google topic, for example, has been referred to countless times, yet you’re still asking for information that’s given in that topic. That makes me feel like you don’t care enough to even read it. Following that, if you don’t care, then why should I?
  • Most of your questions come down to:“tell me how to build my project”. In your original post you asked for step by step instructions. Again, we’re glad to help, but we’re no building manual. We can give you general pointers on where to look, and provide you with useful informations, but we can’t and won’t build it for you. That’s up to you.

If you still want to pursue this path, then get someone who knows what he’s doing to help you. If you find such a person, then feel free to ask some more questions. Until such time, I’m afraid neither @peekay123 nor I can be of much help any more. There’s only so much we can do over a forum, and teaching electronics and programming is (un)fortunately not one of them.

Regardless of your decisions, I wish you the best of luck!

3 Likes

Let me try this again. It was, and is, in no way ever my intention to be either offensive or demotivating.

The reason I said it feels like you want a step by step guide, was/is due to the fact that you don't seem to take up information unless it's chewed up in nice little chunks.
The Google Spreadsheet is a good example of that. I know and understand that that topic might look daunting at first, but if you had bothered to properly read it, you would've noticed that there are examples in there which tell you what's happening. It's even commented in multiple places. That doesn't mean you should immediately understand it, but saying "I saw there was code" gives me the impression you didn't bother to look at the code itself.

Believe me when I say we share the same "you-can-do-this" mentality. Maybe it's due to some more experience that we can relate to that a bit more realistically. What you're asking us to explain are things that I'm currently being thought in university. They're not easy to understand, albeit still being relatively easy. It's mentioned before, but perhaps you're taking on more than you can handle, without professional/experienced help.

That's not a question that can be answered on a forum. Most of the concepts being applied in the project you're describing take many years of higher education to get even a basic grasp of. What you've currently built is probably also above your level of knowledge, considering the fact that you didn't knew PH and conductivity are related, for example. That's not a bad thing. The project is surely very interesting, but do you actually understand what's happening on a lower level? Ion exchange, chemical reactions, flowing currents, conductivity, Ohm's Law, Transistors, potentiometers, resistance. Those are no easy concepts to understand.
Unless you understood all of those concepts decently, there's no way you could've built that project without a guide of some sort (which is what you've linked to). Again, that's not a bad thing.
The fact that you'd like to add internet connectivity to it, and expand the current project is also very admirable. The only catch lies in the fact that there are again new, and difficult, concepts to learn, for which there isn't a manual/guide this time. Like I've said before, you'll need to think of things on your own. And when the basic knowledge isn't there (yet), that's nearly impossible.

What has changes since? The fact that you removed that text doesn't mean that your questions don't imply the same. If you do not want step by step answers, then what do you want, exactly? "how does this work" is too vague of a question to answer. We've given you ideas on how you could measure PH values (using the conductivity sensor you built), and we've given you several options to get this information on the web (think Google Spreadsheets), which even included a guide how to do so. If you don't want to use step by step guidance, then please do share what exactly it is that you want?
A recent example of this is the question for me to go through the whole Google topic, and lay it out for you in sizeable chunks. That, to me, sounds like you want me to shop it up into steps you can follow. Other than the fact that I don't feel I should be doing your projects, for reasons listed in several posts, I think you could put in the effort to at least try it yourself. If there's something specific you don't understand, then by all means, please ask away. But in order for that to work, we need concrete questions, like:"why do you assign a variable to that?", or "why do we need a function for that?", not something like:"could you summarize the topic for me?".

It's not that we don't want to help, but there's only so much we can do. If the foundation isn't there, then there little to build on. Building a house on quicksand could also be considered "a bit challenging", using your analogy.
Also, it's not just "a bit challenging". Some of the concepts that are being applied is material that's currently being thought to me at a technical university, studying Electrical Engineering and Computer Sciences. I don't consider myself to be stupid, but half of the stuff in there is still black magic to me. If I asked you to explain Quantum mechanics to me right now, or rocket science for that matter, would you be able to to it? Although it might not sound as fancy, it's a least comparable in terms of difficulty. You shouldn't underestimate that.

You've nailed the EXACT cause of the problem. You ARE in a world where you don't understand the language, or the customs and traditions. Is it reasonable to expect someone from the other side of the world, to teach you all that? They can't teach you everything, but they can push you in the right direction. They can tell you to take a course for the language, or tell you to go to the library to study the customs, or mingle with the people to learn the traditions. But he can't do it for you. If you're going to grow in that strange world, you must do so on your own. Getting help and guidance from others isn't the problem, but they can't learn it for you.
The fact that you're "alone" makes it even worse. Try to imagine that you have to teach a three year old how to ride a bike. Sounds reasonable, right? Now imagine that that kid has never seen a bike. It's also deaf, and can't speak your language. Oh, and also, you're going to have to do it from the other side of the world over a computer.
Sounds ridiculous, right? That's pretty much the problem we're facing. It's not that we don't want to teach the kid how to ride it's bike, it's just so hard when there are so many hurdles to cross. Now, If you were there, you could show the kid how its done. You can hold it's bike, and make sure it doesn't fall. You can help where needed. That is REALLY hard to do from behind a computer screen.
That is the reason why we've said you need experienced help locally. Unless you've got someone helping you out if you find problems, and guide you, it's near impossible for us to help you.


Again, I was in no way trying to be offensive, and I apologise if you feel like I was. I hope the above can make you see some of our standpoints, and help you realise why it's such a difficult issue.

I wish you the best of luck in your future endeavours!

4 Likes

I have a friend who can code multiple amount of coding languages. He would like to know which coding language Google Spreadsheets is in, I discovered some Python, JavaScript but in a previous post you mentioned the use of C/C++?

Ignoring the above mentioned things, try this.
The reference to the C/C++ part can be found here, give it a read :wink:

1 Like

@peekay123
@Moors7
If I wanted Google Spreadsheets to send data to IFTTT

Should it be something like:
If received data on Google Spreadsheet then send data to john.smith@gmail.com?

@benclough, which probe are you looking at?

You can setup the core to send data TO a Google Spreadsheet at regular intervals (15 secs for example). @Moors7 already provided a link that explains how. You and your friend need to read what was posted!