Need help programming for my handicapped friend

Hi guys,

I am a total Arduino noob and have no idea what im doing. I wanted to build something simple but found myself over my head pretty quickly.

I have a handicapped friend who is confined to a wheelchair and breathing device. I often take him to concerts and movies.

The problem mostly during concerts is that i cant really keep an eye on his breathing device. He has a panic button that is connected to his home system but on the road ist does nothing. His conditioning has been worsening and he needs help often so he needs to be able to signal me.

I want to connect this button to a arduino so that when he presses the button lights will go on and a buzzer will sound. I can than keep an eye on these lights and if needed help him.

So here is what i need:
2 states that switch on a button
State one: single green LED burning to signal okay with buzzer off
State two: 8 LEDs alternating white and red flashing full brightness and buzzer on

What I have:
-Arduino Genuino Uno
-8x WS2812B LEDs with resistor (working on pin 7)
-Buzzer (5V from FPV drone)
-Connector for alarm button

This is probably very simple but i cant figure it out my self. We are going to another concert this weekend and i would feel much better if he can signal me.

Anyone please help with the programming.
Thank you in advance!

Yes, you are over your head here! :roll_eyes:

Two big problems here:

  • You have failed to specify your project. Just what is this button he might press and what is the LED display to alert you supposed to look like? Perhaps more to the point, how close will they be and will they be connected by a cable or are you expecting remote control?
  • You need to describe in absolutely critical detail, the "panic button" he already has. Do you expect to modify it or attach anything to it in any way? If so, will that void the warranty for the service (hint: it will. :astonished: ) How do you expect to deal with that?

Arduino devices are in no way certified for "mission-critical" applications, including automotive and medical devices of practically any form. If you build it, you are certifying its suitability; no-one else here or associated with Arduino or Atmel/ Microchip in any way, will take any responsibility for its operation.

Thank you for your reply.

  1. The display is 8x WS2812B LED (LED 0 to 7) (pin 7) and one buzzer (not yet connected).
    The alert should be the following:
    -All LED’s turning on full brightness
    -All LED’s alternating between red and white color every 0.5 seconds
    -Buzzer making noise (alternating beeps or full on does not matter)

Standby state should be:
-LED 7 on green color
-All other LED’s off
-Buzzer off

Button should switch the state.

The button is connected to the system via a 3.5mm Jack. I have a female jack that this can plug in to. so i dont need to mess with the original system.
I thought the term button was clear enough but to specify more:
-there is 2 lines going to the button
-pressing the button closes the circuit
-when released the circuit is open again (it is not a switch)
-Line is about 1.2 meters (4 feet) long

I hope that is clear enough, please let me know if you need aditional info.

Thanks for the help

BL12Z:
I am a total Arduino noob and have no idea what im doing. I wanted to build something simple but found myself over my head pretty quickly.

To get your feet wet, work through and get some understanding of the principles contained in the first five sketches in IDE -> file/examples/digital.

I got something that works, it aint pretty :slight_smile:

Now only the buzzer.
Its not a normal buzzer but a 5 volt one.
I guess i can make it beep by pretending its an LED.

The forum has corrupted the code you posted. That's why you should read the forum guide in the sticky post. The guide tells you how to use the forum, things like how to post code correctly.

OK, you have clarified that part - there is no issue of significant alteration or interference with the original system (other than wear-and-tear plugging and re-plugging the cable).

BL12Z:
-when released the circuit is open again (it is not a switch)

Well, by that you mean it does not “hold” in the “on” position. There are of course, “push-on, push-off” button switches.

And it uses a 3.5 mm plug. Two pole or three pole? Particularly when the “sleeve” connection of the jack is one of the connections, it is important that the button be grounded on one connection, not connected to Vcc. This is mostly for electrical safety, but also to minimise the potential for interference. Your code implies an inappropriate way of connecting it, expecting the button pin to read HIGH when actuated.

Please specify what your buzzer actually is - give us a Web reference rather than circuitous attempts to describe it. This is so we can verify the correct method of connecting it.

If this is supposed to have a “pilot light” indication, you need to discuss what you propose to use as a power supply as current consumption will be a significant point.

We understand this is a simple wired connection, you are not intending a “remote control” version.

Now as to the code, you need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the “More → Modify” option below the right hand corner of your post - to mark up your code as such using the “</>” icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE has a “copy for forum” link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don’t forget to use the “Auto-Format” (Ctrl-T) option first to make it easy to read. If you do not post it as “code” it can as you now see, be quite garbled and is always more difficult to read.

It is inappropriate to attach it as a “.ino” file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And that would also assume they are using a PC and have the IDE running on that PC.

Also tidy up your blank space. Do use blank lines, but only between complete functional blocks.

Hey guys,

Thanks for helping!

So it is doing what i need it to do but when you see what ive done you will probably start pulling some hairs out.

I connected the buzzer to the internal LED pin (13) and when the LED goes off the buzzer turns on. Was expecting it to work the other way around but okay, it works.
Its one of these buzzers, super cheap and loud: https://www.banggood.com/custlink/3mDDt6PjYn

So with the short loop on the standby and the long loop on the alarm its real easy to set off the alarm and hard to switch back to standby. This is also an accident but i like it.

So im stumbeling around copying code from all around, but its working.

-It is a 2 pole connection
-It has one LED pilot light, its powered by a 2500Mah 2S LiPo, should use about 100mah so i think it will get me trough a day.

Check out this mighty contraption in action here: Systeem Hans test - YouTube
I already printed the bottom of the case, still working on the top.

Please check it out and feel free to suggest improvements.

#include <FastLED.h>

#define LED_PIN     7
//#define CLOCK_PIN 4 
#define NUM_LEDS    8
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
#define BRIGHTNESS  255



//Mijn extra code:
int buttonpin=2;
int reading;
int ctr=0;



CRGB leds[NUM_LEDS];

void setup() {
    delay(1000);
    LEDS.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
//  LEDS.addLeds<LED_TYPE, LED_PIN, CLOCK_PIN COLOR_ORDER>(leds, NUM_LEDS);
    FastLED.setBrightness(BRIGHTNESS);


  pinMode(buttonpin, INPUT);
  pinMode(LED_BUILTIN, OUTPUT);



}

void loop()

{



 reading=digitalRead(buttonpin);

    if(reading==HIGH){
      ctr++;//if button is pressed, counter goes up by one
  }
  //I figured when you want the circuit ON the button
  //will have been pushed an odd amount of times so the
  //LEDs blink on and off when ctr is odd
    if(ctr%2!=0){

    fill_solid(leds, 1, CRGB(1,255,1));
  FastLED.show();
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(500);
  FastLED.clear();
    
    digitalRead(buttonpin);

    }
  //LEDs turn off when ctr is even
  if(ctr%2==0){

//Alarm:


  
  FastLED.clear();
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  fill_solid(leds, NUM_LEDS, CRGB(255,1,1));
  FastLED.show();
  delay(1000);
  FastLED.clear();

  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  fill_solid(leds, NUM_LEDS, CRGB(255,1,1));
  FastLED.show();
  delay(1000);
  FastLED.clear();


  fill_solid(leds, NUM_LEDS, CRGB(255,1,1));
  FastLED.show();
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(40);
  FastLED.clear();
    
  FastLED.show();
   digitalWrite(LED_BUILTIN, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(40);
  FastLED.clear();


  for(int i=0;i<NUM_LEDS;i++){
    leds[i].setRGB(255,255,255);
    FastLED.show();
     digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(40);
 }
  FastLED.clear();

    for(int i=0;i<NUM_LEDS;i++){
    leds[i].setRGB(0,255,0);
    FastLED.show();
     digitalWrite(LED_BUILTIN, LOW);   // turn the LED on (HIGH is the voltage level)
    delay(40);
 }
  FastLED.clear();

    for(int i=0;i<NUM_LEDS;i++){
    leds[i].setRGB(1,0,255);
    FastLED.show();
     digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(40);
 }
 FastLED.clear();

    for(int i=0;i<NUM_LEDS;i++){
    leds[i].setRGB(255,0,0);
    FastLED.show();
     digitalWrite(LED_BUILTIN, LOW);   // turn the LED on (HIGH is the voltage level)
    delay(40);
 }
  FastLED.clear();

 
  }}

Final box is finished