Arduino with weight sensor

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

Rania Elmansy
4 min readMar 1, 2016

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:

  1. Connect one side of the first resistor with the blue wire from sensor and connect this point with red jumper
  2. Connect one side from the second resistor with the black wire from sensor and connect this point with black jumper
  3. 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)
  4. Connect the red wire from sensor with a green jumper
Figure 1: The whole circuit

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:

  1. Black wire to ground in the weight scales
  2. Green wire to A+
  3. White wire to A-
  4. Red wire to out+

As you can see in figure 2.

Figure 2: Load Cell to Weight Scales first side connections

Weight Scales to micro controller (arduino) side

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

  1. Brown with ground
  2. Orange with CK/TX
  3. Yellow with DO/RX
  4. Red with VCC

As you can see in figure 3.

Figure 3: Weight Scales first side connections

Then connect these jumpers with the Arduino:

  1. Brown with Ground
  2. Orange with A0 (any digital or analog pin)
  3. Yellow with A1 (any digital or analog pin)
  4. Red with 5V

As you can see in figure 4.

Figure 4: Weight Scales to arduino connections

Software

All programming is done in three steps as follows:

Connecting with twitter

  1. Sign up for a Twitter account if you don’t already have one.
  2. You’ll also need to register your application with Twitter.
  3. Obtain your API Key and API Secret which can be found on the API Keys tab on your application page.
  4. 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:

  1. Sign up to temboo to create your account
  2. Navigate to libraries and from left menu select “send direct message”
  3. Turn model IOT on and select the arduino and select the arduino ethernet and add its MAC address
  4. 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.
  5. 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.

www.modeso.ch — Your nearshore partner for web and mobile development
We are a young Swiss company, with its headquarters in the Lake Constance region, which was founded in 2013 and has been on track ever since. Modeso is specialized in custom
Nearshore-Models in the field of web and mobile development. We support companies from startups to large enterprises with highly qualified software developers at fair prices.highly qualified software developers at fair prices.

--

--