Arduino with Weight Sensor

Helping employees to not sit down for long time without any activity.
egypt

At Modeso we created a sample demo as application on internet of things (IoT) using Arduino in our hack day.

The idea was to help employees to not sit down for long time without any activity, so we thought to notify them by using any social platform like Twitter, if they sat down for certain period of time.

This post is about how we created this application.

Hardware components

  • Weight Sensor (Load cell)
  • 50kg Weight Scales
  • Analog-to-Digital Converter (ADC) 24-bit
  • 2 resistors 1 kohm
  • Board
  • Some jumpers
  • Arduino uno
  • Ethernet shield

Hardware setup

We’ll explain the connection in two steps, from weight sensor to the weight scales and from weight scales to arduino.

Load Cell to Weight Scales

For the weight sensor we need to add one more output wire to the three already existing.

On the board we’ll do the following:

  • Connect one side of the first resistor with the blue wire from sensor and connect this point with red jumper
  • Connect one side from the second resistor with the black wire from sensor and connect this point with black jumper
  • Connect the second free sides from both resistors with each other in the same point and from this point we get the fourth wire that we need (white jumper)
  • Connect the red wire from sensor with a green jumper

Now we have four wires from this circuit in the colors White, Green, Black, Red and need to connect them with the weight scales as following:

  • Black wire to ground in the weight scales
  • Green wire to A+
  • White wire to A-
  • Red wire to out+

Weight Scales to micro controller (arduino) side

On the other side of the weight scales we need to connect four jumpers:

  • Brown with ground
  • Orange with CK/TX
  • Yellow with DO/RX
  • Red with VCC

Then connect these jumpers with the Arduino:

  • Brown with Ground
  • Orange with A0 (any digital or analog pin)
  • Yellow with A1 (any digital or analog pin)
  • Red with 5V

Software

All programming is done in three steps as follows:

Connecting with twitter

  • Sign up for a Twitter account if you don’t already have one.
  • You’ll also need to register your application with Twitter.
  • Obtain your API Key and API Secret which can be found on the API Keys tab on your application page.
  • Generate the required Access Token and Access Token Secret by clicking “Create my access token” from the API Key tab.

Using temboo

Temboo helps us to generate code for a certain purpose like sending a twitter direct message:

  • Sign up to temboo to create your account
  • Navigate to libraries and from left menu select “send direct message”
  • Turn model IOT on and select the arduino and select the arduino ethernet and add its MAC address
  • Fill the required data in INPUT section like: AccessToken, AccessTokenSecret, ConsumerKey, ConsumerSecret, UserID with is the ID of the user who should receive the direct message and the direct message text then click Run.
  • After clicking “run” we’ll have two files as outputs, one for the arduino code and the other for Temboo account information, download these two files.

Arduino Code

Now we have the code that will send a twitter direct message, the next step is to get the sensor readings.

A reading less than a certain value means that the user did stand up. Correspondingly a greater value tells us that the user is still sitting on his chair.

Everytime the user sits down on his chair we use a timer to count the time he’s sitting on his chair. Once the timer hits one hour, we’re calling a method that sends a direct message to the user telling him that he is already sitting down on his chair for more than one hour and that he should do some activities. Independent if the user finally stands up or not, we need to reset the timer.

You can find full code here.

Summary

Working with arduino is fun and easy, i hope you can try this sample application to have a quick idea about the internet of things (IoT) which is the future technology.

Did we inspire your curiosity? Get in touch! We’re happy to provide you with more detailed information.