Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Brian CottrellDiego Humberto Gonzalez AlanisSarah HanRobert Wu
Published © GPL3+

Solmate

Solmate is a portable suntan monitor that allows beach goers to achieve the perfect tan without risking sun damage.

IntermediateFull instructions provided5 hours1,389

Things used in this project

Hardware components

Grove starter kit plus for Intel Edison
Seeed Studio Grove starter kit plus for Intel Edison
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Solmate lid

Used for mounting the various sensors and LCD.

Schematics

Diagram

Parts Diagram

Code

Solmate twitter integration

Python
Python code for uploading data to twitter
import twitter
import random
import time
from datetime import datetime
import smtplib
import argparse

def sendMess(percentIn,e,t,u):
	CLIENT_ID = "1290d6798b1a4e9"
	sender = "troop138wu@gmail.com"
	eRecievers= ["6262413103@tmomail.net"]
	if(percentIn<0 or percentIn>100):
		print 0
		return
	elif (percentIn<=20):
		messageIn="Keep calm and get your tan on. Remember to use an SPF!"
		tweet(1,e,t,u)
	elif (percentIn<=40):
		messageIn="Time to soak up the sun! The sun is high, and the tan is low."
		tweet(2,e,t,u)
	elif (percentIn<=60):
		messageIn="Sunscreen is recommended for toaster oven conditions."
		tweet(3,e,t,u)
	elif (percentIn<=80):
		messageIn="You're now equivalent to a baked potato."
		tweet(4,e,t,u)
	else:
		messageIn="You're fried chicken status. Time to go home for the day."
		tweet(5,e,t,u)
	try:
		#print "Sending message to " + recvname + "...",
		server = smtplib.SMTP(host='smtp.gmail.com',port=587)
		username = 'troop138wu@gmail.com'  
		password = 'Wu123456'  
		server.ehlo()
		server.starttls()  
		server.login(username,password)  
		server.sendmail(sender, eRecievers,"From: " +"in"+ "\n"+"To: " +"out"+ "\n"+"Subject: " + "SOLMATE!"+ "\n"+messageIn)         
		server.quit()
		print "successfully sent!"
	except  Exception:
	    print "Error: unable to send message"
	print 1

def tweet(choice,e,t,u):
	tweets=['Happy to soak up the sunlight for the day!','I know #Solmate always has my back for getting a perfect tan.','Safely getting a healthy amount of UV rays for the day!','Having fun under the sun. Make sure to wear some shades and sunscreen!','I just got my daily dose of Vitamin D and Calcium']
	api = twitter.Api(consumer_key='d6RF46ZYRC1EMJ9GFfhwAsPHo',
	                      consumer_secret='syq9klXBYYQbAnSVm6ie3qPpi2PFtO2nwQI0nEdsYMWxDGIUgJ',
	                      access_token_key='3246491366-V2KQG7EF1R6rAFZv4GCsZLw8kEZOuXHaUUEUq1n',
	                      access_token_secret='5nPvjXaJscb8wqKH32RSy3jTrA4VnP9PPJxvesG8Q3NIg')
	choice=tweets[choice-1]+' #'+e+'mins #'+t+'F #uv'+u+' #SolMate #IntelMaker'
	try:
		status = api.PostUpdate(choice)
	except:
		choice+=' #'+(str(datetime.now()))[:10]+' #'+str(int((str(datetime.now()))[11:13])-7)+(str(datetime.now()))[13:19]
		status = api.PostUpdate(choice)
	return status.text

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="send message and tweets")
    parser.add_argument('-m', '--message', dest='mess', help='message')
    parser.add_argument('-e', '--e', dest='e', help='elapsed time')
    parser.add_argument('-t', '--t', dest='t', help='temperature')
    parser.add_argument('-u', '--u', dest='u', help='uv')
    args = parser.parse_args()
    mess=int(args.mess)
    sendMess(mess,args.e,args.t,args.u)

Solmate Arduino Code

Arduino
Entire structure of the Arduino code
No preview (download only).

Solmate Selfie Sun Mobile App apk file

Java
Download the apk file to install the app on your mobile device, the complete Android Studio project can be found at: github.com/BrianCottrell/selfie-sun
No preview (download only).

Credits

Brian Cottrell
11 projects • 16 followers
I am a software developer with a background in physics and low level programming and I am currently focused on web and mobile development.
Diego Humberto Gonzalez Alanis
1 project • 0 followers
Sarah Han
13 projects • 79 followers
Software Engineer, Design, 3D
Robert Wu
1 project • 0 followers
Junior at USC. Go Trojans!
Thanks to Justin Cheng.

Comments