Go Down

Topic: Help with LilyPad project (for a good cause) (Read 7744 times) previous topic - next topic

ABH1984

Oct 13, 2019, 06:30 am Last Edit: Oct 26, 2019, 02:26 am by Coding Badly
I am hoping to use the LilyPad hardware to help my son. He was born with a disorder that causes him to move his head in a rhythmic motion at certain times. He has seen multiple doctors and neurologist over the course of ten years. Medically nothing can be done to help his issue, however they stated that as he gets older he might learn to recognize the motion and stop it himself.

My hope is that with the lilypad hardware it can be placed into a hat and using an accelerometer the motion can be recorded and a LED light lights up when the motion is detected. This should alert him to the motion and help him learn how to stop it.

I have already bought all the hardware and paid a individual to write the needed program. However once the program is installed on the hardware, the motion seems to not trip the needed altering feature (LED, Buzzer, or so on.) I have played with the program a little but my technical knowledge is very limited when it comes to this stuff.

I am hoping by coming to a forum for help that someone might be able to help me find the issue. I will attach all that I have on this project. Please let me know if anyone can help.





Code: [Select]

#define ONBOARD_LED_PIN   13
#define NOTIFICATION_PIN  2
#define PROGRAM_LED_PIN   5


void setup() {
  pinMode(ONBOARD_LED_PIN, OUTPUT);
  pinMode(NOTIFICATION_PIN, OUTPUT);
  pinMode(PROGRAM_LED_PIN, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  Serial.print(analogRead(A0));
  Serial.print(" ");
  Serial.print(analogRead(A1));
  Serial.print(" ");
  Serial.println(analogRead(A2));

  digitalWrite(ONBOARD_LED_PIN, HIGH);
  digitalWrite(NOTIFICATION_PIN, HIGH);
  digitalWrite(PROGRAM_LED_PIN, HIGH);
  delay(200);
  digitalWrite(ONBOARD_LED_PIN, LOW);
  digitalWrite(NOTIFICATION_PIN, LOW);
  digitalWrite(PROGRAM_LED_PIN, LOW);
  delay(200);
}

wildbill

Your code will unconditionally light the LED, buzz the buzzer and vibrate the vibe thing. That it apparently doesn't suggests to me that you have a power issue. Your diagram seems to have a tiny key fob style battery - is that the case? 

ABH1984

Yes it uses a small coin battery. The intent is to have the assembly hidden away on the inside of a hat that he can wear.

So the way it is supposed to function is. He wears it on top of his head and as he does the motion, I use the program button to record and store the accelerometer values. Once the values from the accelerometer are stored, the programs assigns a +_- value to them and then looks for similar values. Once it detects similar values ( the bobbing motion) it is supposed to send power to the device being used to alert him.

This should allow him to learn when he is doing the motion and possibly stop it as he begins to recognize it.

So I have not be able to get past the recording of the motion. I followed the instructions given to me by the program writer and I am now stuck. To be honest I had given up on the idea of this working and it has been several years since I started all this. So going back to the original program maker is not possible. This is why I have sought out a forum as a last ditch effort.

He is now in school and kids being kids are giving him a hard time. So I am really hoping that it is an easy fix to get the wearable up and running.

Thank you for any input or help. It is very much appreciated.

wildbill

I suspect that it will be harder than you think to do the signal analysis to identify a particular head movement.

However, first you will need to get past your power issue. Does it work with USB power?

ABH1984

So with a USB hooked up I can run the program and see the values from the accelerometer. However again the program button (which records the motion) seems to have no affect on the code. It has been a while since I have tried it all, like I stated before it fell off my to do list.

The system will run off the coin battery and the program button when pushed will cause the light to light. I do not remember it staying on constantly. However it seems as if the program never stores the information. From my very limited knowledge I feel like this issue is there.

The guy who wrote the program sent me graphs showing how everything was being tracked and worked. However I no longer have that information due to the time period. I am more than happy to ship the hardware on good faith if anyone feels like they can truly help.

I understand it is hard to troubleshoot and help if you can only see one side of the build.

wildbill

I wonder if you have attached an early version of the code. It doesn't read a button, doesn't do anything with the accelerometer values and just unconditionally toggles the outputs about five times a second.

While this is arguably the right place for this topic, you might consider asking a moderator to move it to "Project Guidance" - there's a lot more folks reading topics there.

ABH1984


Coding Badly


Go Up