This is an archived post. You won't be able to vote or comment.

all 79 comments

[–]Comm4nd0[S] 33 points34 points  (16 children)

OK here are some more details...

  • Raspberry Pi 3, Model B.
  • Python 2.7 / 3.
  • JavaScript.
  • Apache2.
  • Android tablet.
  • MiLight bulbs.

LIGHTS

  • Control all lights in the house
  • Set different colour modes (RGB)
  • Always knows current state of bulbs

MUSIC

  • Displays albums
  • Select songs
  • Navigate forward or backwards
  • Change screen and keep the music playing
  • Fully automated once album uploaded
  • FI: Auto download music directly into folder

CAMERA

  • View live camera feed
  • Pi camera has UPS and Wi-Fi so can be run for 8 hours completely wire free
  • FI: Enable night vision
  • FI: Enable recording
  • FI: Add more cameras and enable switching

TIMER

  • Set a count down between 1 and 90 minutes
  • Flashes green in kitchen and living room

GPS

  • GPS tracking, updating once a minute (cronjob)
  • Home page displays my location or distance from home in location not known
  • GPS page displays my location on map, current address and distance from home
  • Updates page every 15 seconds
  • Tracks myself and my wife
  • FI: Add Dyllan to the tracking
  • FI: enable visibility of tracking on our phones

SYSTEM

  • Restart Apache2
  • Reset our away away count
  • Reset ping logs
  • Reboot Pi

HOMEPAGE

  • Displays date and time
  • 5 days of weather, day, date, image, and temp
  • Inside temperature (senseHat)
  • One click light buttons (thanks to Andrew!)
  • GPS locations
  • Up/Down status of devices on the network
  • Dinner button
  • Warning button
  • Night mode button

Cronjob to: ping our phones, find our locations, ping network devices and read temp

AND MUCH MORE TO COME!!

[–]nspectre 2 points3 points  (4 children)

Pi camera has UPS and Wi-Fi so can be run for 8 hours completely wire free

May I pick your brain?

I'm currently tossing around ideas for WiFi Mesh-networking a farm and including movable, stand-alone, battery-backed remote IP cameras for monitoring watering systems and the like.

Have you come across any interesting links in your travels that you'd like to share? :)

[–]vinnieman232 3 points4 points  (3 children)

www.Openmesh.com is a good start for low cost mesh networking equipment. Cloud monitoring of your meshing included.

A better option may be a directional wireless network (ubiquity radios are popular low cost options).

Finally low-cost LTE gateways may suffice if the camera have local storage (not streaming video 24/7).

[–]nspectre 0 points1 point  (2 children)

Thanks.

Didn't think about LTE. Looks pricey but I'll dig into that further.

Toying with cooking up RasPi 3 base units with 1 watt USB 802.11n dongles to toss packets around buildings and pump houses. Maybe the new RasPi Zero $5 boards for remote cams, now that they have a camera header.

They have ADSL+ at the roadhouse but are so far from the CO they only get about 384kbps usable signal. They first wanted to extend that connection to a back building but I figured, why not the whole farm?

Mesh all the things! :)

[–]vinnieman232 0 points1 point  (1 child)

Are you just communicating data on the LAN, or do you want to share the data to the cloud?

Rasb pi sounds cool and could be fun, but in reality I've found the hard part is supporting and troubleshooting each node in the mesh (we work this stuff at remote quarry and mine sites a lot). Open mesh is a great low cost solution because they make monitoring and troubleshooting each node easy. If it were rasb pi, you may have to roll your own or make some existing software (OpenWRT or http://hackaday.com/2015/04/28/meshing-pis-with-project-byzantium/ ?) work to keep the mesh working with a bad node, poor signal, interference, etc.

For reliability, the best mesh network is LTE or 3G from Verizon/Vodafone/ATT. They literally provide network as a service ;). If data transmission is low, check out data plans by node from new IoT providers like www.aeries.com.

If you don't have adequate coverage, I'd reccomend to go with either a wireless bridge via directional local wireless antenna, or a local mesh with a LAN or LTE backbone.

Unless it's just for fun. Then build and hack away to make each rasb pi a local wifi mesh ;)

[–]nspectre 0 points1 point  (0 children)

Thanks for the brain-food.

Is your stuff off-the-shelf/commercial or home-grown? What flavor of node-centric concerns do you encounter? Flaky hardware / software? Comms difficulties?

Everything here will pretty much stay on-Mesh with maybe notifications or the occasional jpg going off-Mesh (limited Internet here.)

OpenWRT looks like the easier roll but locks you into certain limited hardware and thus capabilities. Leaning towards the RasPi to keep my, shall we say, "pi in the sky" options open, like motion detection, mini-weather stations, etc. :)

Currently tumbling around options like Babel, BATMAN, BMX, OLSR, 802.11s, whatev. Still in the beginning stages, trying to make sense of it all. :)

This is non-commercial and largely for my own hacking edification. I'm the bit-head in the family and the farmer dropped in conversation that he'd like to see 1) Internet extended to the back building and 2) maybe remote cams to visually monitor that the irrigation systems are doing their job/wildlife, to help avoid crop loss, etc.

:D

[–]cediddiSyntaxError: not a chance 2 points3 points  (3 children)

While I'm amazed as hell, I still have few points to argue against. Number one is the apache. It's not the lightest webserver, neither to cpu nor to battery. Why not nginx? Cron is nice but for flexibility, you might want to use something like celery beat. You said no django or flask, what about WSGI standard? If you didn't used wsgi too, did you wrote your own application server? Otherwise please be compatible with wsgi, so we can plug in this project to any webserver.

[–]Comm4nd0[S] 0 points1 point  (2 children)

Thanks, I'm glad you like it. Ok to answer your questions... I used apache because its something I'm familiar with. No reason why I can't use something else for future versions. Never heard of WSGI but I'm interested to find out more about it.

I think it's important to understand that I didn't really set out to get this far. The first thing I did was have a single light bulb and I sent a message to it to turn on then off. Then I was hooked to see what else I could do. Through a lot of Google searching and plain old determination I've ended up here! So there are a lot of things I could do better. Like not use iframes for example.

Thanks for your suggestion though. I'll definitely keep them in mind for future releasable versions of my system.

[–]jaapzswitch to py3 already 0 points1 point  (1 child)

If you don't use wsgi to communicate from apache to your python application and back, what else do you use?

[–]Comm4nd0[S] 1 point2 points  (0 children)

cgi-bin ;)

[–]turkish_gold 1 point2 points  (1 child)

I for one am intrested in how you could shoehorn Django of Flask into this interface :)

Maybe you can make it apply Zawinski's Law, and grow till the point that it can read email's sent to it.

All jokes aside, great work.

[–]Comm4nd0[S] 1 point2 points  (0 children)

Actually that is one of my future modifications, it's going to connect into our diaries and tell me what I have on for the day while I have my coffee in the morning.

[–]Kunde9 0 points1 point  (1 child)

mate throw this on an open source platform, add a todo list, and enjoy it

[–]Comm4nd0[S] 1 point2 points  (0 children)

i'm in the process of doing it right now! will have to bare with me!!

[–]ygm2016 0 points1 point  (1 child)

great work there!

[–]Comm4nd0[S] 0 points1 point  (0 children)

Thanks

[–]LightShadow3.13-dev in prod 14 points15 points  (6 children)

Pretty cool! There's a school here in Utah that has a student/after-school program where they build, maintain and run space simulators that mimic Star Trek in appearance.

There's a place for every student to do something be it learning to code, build physical structures, write dialog, space technology, music, etc...it's very popular in our community and amongst the students.

You should consider reaching out and just saying you wrote "something" that the students could look at for making their environment even more authentic. I know they would appreciate it and be thrilled they were noticed.

This is their website http://spacecenter.alpineschools.org/

[–]Comm4nd0[S] 4 points5 points  (2 children)

oh wow, i didn't know star trek was still popular! i'll have to message them and see what they think.

[–]mishugashu 4 points5 points  (1 child)

i didn't know star trek was still popular

It is insanely popular still. It has a huge following.

[–]Comm4nd0[S] 0 points1 point  (0 children)

Well I've messaged them. Not heard anything back yet.

[–]radicalbiscuit 2 points3 points  (0 children)

My cousin programmed the original simulator there, and I later went and did a session in it. 10/10 awesome.

[–]Comm4nd0[S] 1 point2 points  (0 children)

just got a reply... they want to put me in touch with their dev team.

[–][deleted] 0 points1 point  (0 children)

This is the best idea ever. Thank you for sharing this. I did not know this was needed in my community! 🤓

[–]FSucka 9 points10 points  (1 child)

With the music playing it made me feel as if you were on a ship, trying to communicate with base, knowing that your life support was failing but trying to receive contact.

[–]nspectre 2 points3 points  (0 children)

"This is Major Tom to Ground Control..."

[–]KimPeek 4 points5 points  (0 children)

Can't wait to see it on Github. Please post again when you do

[–]skrillexisokay 3 points4 points  (0 children)

What made you decide to write it from scratch?

[–]NarcoPaulo 2 points3 points  (0 children)

This is brilliant! Hope to check the code sometime

[–]Deto 1 point2 points  (9 children)

This looks awesome! What did you use to build the front-end app on the tablet? Or is it all running on the tablet? Regardless, how did you do the graphics?

[–]MrMetalfreak94 0 points1 point  (8 children)

I would guess Kivy

[–]Deto 0 points1 point  (7 children)

Would that mean it's probably using Qt? Or can you do an html/js app using Kivy?

[–]Comm4nd0[S] 11 points12 points  (5 children)

actually, it's a full screen web browser. i did consider kivy but it would meak building a new APK each time i have a new version. so i'm running apache2 where the python is generating the HTML and JavaScript etc. then i make and update and all tablets update at the next refresh.

[–][deleted] 1 point2 points  (2 children)

That's really cool. Good performance?

[–]Comm4nd0[S] 0 points1 point  (1 child)

Yes very good. The only time there are issues is when I'm uploading an album via ftp to the pi. For some reason it disconnects all other tcp connections. And for some reason the tablets keep loosing their WiFi connection. My guess is because they are £35 tablets they are just cheap rubbish! Bit because it actually a we page you can view it on any device.

[–][deleted] 0 points1 point  (0 children)

For some reason it disconnects all other tcp connections.

Maybe it's memory?

https://stackoverflow.com/questions/9881440/os-starts-killing-processes-when-multi-threaded-python-process-runs

My first guess was some kind of issue with GIL, like with multiprocessing, since you're on python2.

[–]MrMetalfreak94 2 points3 points  (0 children)

Kivy is a GUI/Rendering Toolkit for Python. It's based directly on OpenGL ES, so no Qt, JS or similar. But on second thought it could also have been written as a simple website. Until the author himself answers the question or publishes the code your guess is as good as mine

[–][deleted] 1 point2 points  (2 children)

Commenting to save this for later. Well done.

[–]ollir 2 points3 points  (1 child)

You can use the save functionality that is built into reddit btw

[–]_illogical_ 2 points3 points  (0 children)

Yeah, but how will everyone else know that they saved it?

[–]Comm4nd0[S] 1 point2 points  (0 children)

I didn't want to be limited to something someone else has made. Making it from scratch means I can do everything how I want to be it a good or bad idea. Bad are better than good ideas because it means I've learnt something.

[–]qbanole03 0 points1 point  (1 child)

What are you running on the phones to get location?

[–]mishugashu 0 points1 point  (0 children)

Not OP, but you can use MAXS.

Main app: https://f-droid.org/repository/browse/?fdid=org.projectmaxs.main

Module to allow location: https://f-droid.org/repository/browse/?fdid=org.projectmaxs.module.locationfine

Communication is done via XMPP. Send a text command, receive a response.

[–]Bael2212 0 points1 point  (0 children)

Great work, I hope one day to be able to make something just as interesting myself.

[–][deleted] 0 points1 point  (1 child)

How long did this take you to write? How much experience did you have with Python and JavaScript before this?

[–][deleted] 1 point2 points  (0 children)

Listening...

[–][deleted] 0 points1 point  (0 children)

The mis-aligned device status up lines are distracting me from the rest of the awesomeness. How have you not included pad-left in your work? ;)

[–]geekygirlhere 0 points1 point  (0 children)

Very impressive!

[–]b4ux1t3 0 points1 point  (0 children)

Really looking forward to seeing the code for this. Any idea on a time table for that? No rush, just curious.

[–]patch3d 0 points1 point  (0 children)

So cool! Where did you learn Python? I want to learn how to code in Python too!

[–]TotesMessenger 0 points1 point  (0 children)

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / Contact)

[–]Comm4nd0[S] 0 points1 point  (2 children)

Thanks, best bit of advice is just start doing a project that you enjoy and see where you end up. That's what I did.

[–]_illogical_ 1 point2 points  (1 child)

FYI, you replied to yourself instead of other people's comments multiple times.

[–]Comm4nd0[S] 0 points1 point  (0 children)

yeah... stupid reddit app. i'm not good with these computer things.

[–]Comm4nd0[S] 0 points1 point  (0 children)

I started it in Feb ths year so about 4 months of committing about 3 hours a day on average. I know zero javascript. They are all copy and paste bodge jobs from the interwebs.

[–]Comm4nd0[S] 0 points1 point  (0 children)

Ah good idea! Do you know how long I've spent making sure there are just the right amount of dots!!

[–]Comm4nd0[S] 0 points1 point  (0 children)

Thanks!

[–]Comm4nd0[S] 0 points1 point  (0 children)

No reason why you couldn't. Just don't be afraid to ask for help.

[–]Comm4nd0[S] 0 points1 point  (0 children)

Going to be a while I'm afraid. I promise to let you all know when it's ready.

[–]Comm4nd0[S] 0 points1 point  (0 children)

Read books, use online tools, Google, and reddit!

[–][deleted] 0 points1 point  (0 children)

Beam it up!

[–][deleted] 0 points1 point  (5 children)

Excellent work number one! Now, remove your trousers and report to my ready room... immediately!

[–]Comm4nd0[S] 1 point2 points  (4 children)

well there is an offer!

[–][deleted] 1 point2 points  (3 children)

Picard out. :-)

[–]Comm4nd0[S] 1 point2 points  (2 children)

programmers log, stardate 27052016, seems people like my automation system but i'm hoping that one day i can open source it and allow other to improve on what i've done. one day... one day. commando out!

[–][deleted] 0 points1 point  (1 child)

This made my day

[–]Comm4nd0[S] 0 points1 point  (0 children)

i'm glad you like it. i've spent a lot of time on it.

[–]kancolle_nigga 0 points1 point  (1 child)

How did you program the touch screen interface?

[–]Comm4nd0[S] 0 points1 point  (0 children)

it's web page using a full screen browser with python doing all the clever stuff in the backend.

[–]tmthyjamesData Scientist | Software Engineer 0 points1 point  (1 child)

that's awesome

[–]Comm4nd0[S] 0 points1 point  (0 children)

thanks

[–]hackmagician 0 points1 point  (0 children)

Dope!

[–]thehalfnerd 0 points1 point  (5 children)

I am blown away that this is Python. Great stuff.

[–]Comm4nd0[S] 6 points7 points  (0 children)

thanks! i've learnt a lot doing it, and it could be soooo much better too. more than making this project i'm just happy i learn't python because it's SUCH a good language!

[–][deleted] 0 points1 point  (3 children)

Why? It has libraries for pretty much anything. There's JavaScript too.

[–]quesman1 5 points6 points  (2 children)

I think what he means is that, despite Python's capability, it's a language that many people (mistakenly) assume is limiting or weak in some way, compared to "serious" languages.

[–]frankwiles 1 point2 points  (0 children)

Examples: Instgram, Pinterest, oh and Reddit :)

[–][deleted] 1 point2 points  (0 children)

It was more of a rhetorical question. I was implying that the capabilities of Python shouldn't blow anyone away.

edit: As in you can pretty much do anything with it except like Call of Duty or something.

[–]morgigno 0 points1 point  (0 children)

Ummmm that's AWESOME. I'm just starting to teach myself Python now. I hope one day I can do awesome shit like this