Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Sumit Kumar
Created August 3, 2020 © GPL3+

Helium Water Hub

A possible way to access clean water.

IntermediateFull instructions provided10 hours74
Helium Water Hub

Things used in this project

Story

Read more

Schematics

Work Flow

You can connect peripherals like ph sensor, water temperature sensor

Code

Helium

C/C++
Upload it on Helium Development Kit
// Components
HTS221Sensor *HumTemp;

void setup()
{
// Initialize I2C bus.
  DEV_I2C.begin();

  HumTemp = new HTS221Sensor (&DEV_I2C);
  HumTemp->Enable();
}

void loop()
{
  //Read humidity, temperature and pressure.
  float humidity = 0, temperature = 0;

  HumTemp->GetHumidity(&humidity);
  HumTemp->GetTemperature(&temperature);
  String str;
  str = humidity + ',' + temperature
  Serial.write(str)
 
}

Training Script

Python
Train the datasets.
import numpy
from keras.models import Sequential
from keras.layers import Dense
from pandas import read_csv

seed = 9
numpy.random.seed(seed)

filename = 'WTA_data.csv'
dataframe = read_csv(filename)

array = dataframe.values
X = array[:,0:11]
Y = array[:,11]
dataframe.head()

model = Sequential()
model.add(Dense(12,input_dim=11, init='uniform', activation='relu'))
model.add(Dense(8, init='uniform', activation='relu'))
model.add(Dense(1,input_dim=11, init='uniform', activation='sigmoid'))

model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

model.fit(X, Y, np_epoch=20, batch_size=10)

scores= model.evaluate(X,Y)
print("%s: %.2f%%" % (model.metrics_names[1], scores[1]*100))

Serial communication

Python
Run it on Raspberry Pi
import time
import serial

ser = serial.Serial(
  port='/dev/ttyUSB0',
  baudrate = 9600,
  parity=serial.PARITY_NONE,
  stopbits=serial.STOPBITS_ONE,
  bytesize=serial.EIGHTBITS,
  timeout=1
  )
  counter=0


while True:
  x=ser.readline()
  print x

Credits

Sumit Kumar

Sumit Kumar

32 projects • 98 followers
21 y/o | Computer Vision Engineer(R&D) @VisAI Labs | Image Processing @e-conSystems | Ex-Embedded AI Engineer @Neuton.ai

Comments