Author Archives: diegoleonbarido

Treading Lightly/Responsible Consumerism

As part of the 2018 Earth Action Initiative at UC Berkeley I was invited by the event (and good friends of mine) to lead a brief workshop discussion about “responsible consumerism”. I am not, by any means an expert on the matter, but try to put a few of these principles in practice so I agreed, and it was fun. It was a great discussion and a lot of us (I think) learned a lot from it.

I summarized some of the things for the workshop in this link (and I’m sharing it with you now). Many are obvious or I’m sure you do them already!

Treading Lightly

It begins with a set of a few truly inspiring characters who have gone above and beyond to tread lightly. Daniel Suelo. Peter Kalmus. Bea Johson. Pancho Ramos. Now, we’re not perfect – but we can do the best we can! The rest of the sheet is a list of daily actions you can take to reduce your footprint. You can see what a huge impact we could have if we all contributed even a little bit to any of these. The actions range from personal divestment (your bank contributes a whole lot to our climate and equity crisis), to food, energy, and waste. The weakest portion in this list is offsets. In part, it is because how confusing they are, and partly because I hold the opinion that a lot of people/companies get away with not changing their behavior by buying themselves out of the problem. That could be too harsh, and at the same time offsets doesn’t mean they can be very effective solutions! The importance is to do the due diligence to put your money where it matters. So I’ve just added the suggestions you guys recommended.

If you want to add to this list or contribute, please let me known and I’ll make you an “editor”!

A Letter to the UC Berkeley Chancellor, asking for debate, community and respect.

This letter was handed in person to the UC Berkeley Chancellor (Carol T. Christ) on Tuesday September 19th 2017. There had been several violent and racist attacks at UC Berkeley, and a lot of contention without dialogue, compassion and dialogue. The school was lacking critical thought and thinking and was mired in debate, without listening. We wanted our leadership to step up and create a safe space for listening and dialogue to all voices.

_ _ _ _ _ _ _ _ _ _

Tuesday September 19th 2017

Dear Chancellor,

We would like to thank you for all the incredible work you have done so far in our community. It’s refreshing to have someone like you communicating with us with such honesty and kindness with what we are currently facing around the country. UC Berkeley has the opportunity to lead the country in the creation of safe spaces for discussion, inclusive of all spaces and points of view. So far, UC Berkeley hasn’t taken this leadership forward, being re-active rather than pro-active to recent events on our campus.

Below we offer six suggestions to foster constructive campus community and dialogue. Conflict, we think, is essential for growth and learning and we should foster constructive discussion so we can all learn, challenge our assumptions, and grow as a community:

  1. Monthly UC Berkeley town halls around topics related to justice, race and good living: Once a month UC Berkeley staff could organize a town hall where students could come and listen to each other’s diverse viewpoints about societal change, debate, and share ideas about how to move forward (or backward). A professor or school counselor could moderate the discussion, and volunteers could take notes. The debate/discussion could be YouTubed or streamed so that an audience around the country can chime in. We should set an example that UC Berkeley cherishes and values all view points, and fosters an inclusive space for discussion.
  2. A bi-weekly two-column “debate” on the UC Berkeley Newspaper: UC Berkeley could announce a list of topics for all weeks in the semester that are open for debate. Then, it would send a request for proposals (100 words max) for two people (or two groups) with opposing viewpoints to each write a column on the selected topic. After being published on paper, the column could be posted online to foster more debate online (moderating for hate speech). Later, this online discussion could be brought to a town hall if there was enough material and interest.
  3. De-scalate contentious speakers: Contentious speakers that come to UC Berkeley (regardless of their political leanings) should have their points of view respectfully challenged. UC Berkeley staff could ask for questions ahead of time and make sure that the speaker sets aside some time to answer difficult questions. We could all learn from having our viewpoints challenged constructively.
  4. Reflection day at UC Berkeley: We, as a community, have not come together to process the events around the country. There are academic lectures and discussions, but no soul searching. A reflection day at UC Berkeley would involve breakout panels to process feelings in the morning, engage in lively structured debates on contentious topic and opportunities in the afternoon, and opportunities for conviviality in the evening where people with disjointed points of view could get to know each other as human beings. The media could be invited to such an event, where UC Berkeley can demonstrate the values of what it truly stands for.
  5. Space for peaceful gatherings at UC Berkeley: Cordoning the campus to create a safe space for one particular group of people is demoralizing and restrictive. When a contentious speaker arrives, UC students should be allowed to peacefully gather in public spaces as long as they can show their student ID to police or administrative staff that is guarding the cordoned area. Just as speakers have a right to express themselves, we as students have the right to peacefully gather on our campus. Making preparations and space for peaceful gatherings is a powerful message of respect towards others, and to free speech.
  6. Symbols Matter: To avoid racist graffiti on campus, UC Berkeley can use symbols as preemptive tactic. Putting banners across campus highlighting the importance of diversity and inclusion to Berkeley sends a message of what we stand for, even if every once in a while our walls are painted with Hate.

Datos Masivos, Ambiente y Justicia

Reposted from Uncode Cafe: http://www.uncode.cafe/inteligencias/datos-masivos-ambiente-y-justicia

Vivimos en la época y el furor de los datos masivos y la inteligencia artificial. Los datos crecen exponencialmente, y la nube – y su capacidad de análisis – se incrementa cada vez más, expandiendo sus capacidades hasta áreas que anteriormente permanecían ignoradas. Aunque tenemos hoy una muy clara noción de cómo utilizar eficazmente los datos masivos para influenciar elecciones o modificar nuestras decisiones como consumidores, todavía falta por demostrarse como los datos masivos y la inteligencia artificial se pueden utilizar efectivamente para mejorar nuestra sociedad.

Continue reading

Whose Hacks? Our Hacks!

Reposted from the Berkeley Energy and Resources Collaborative: http://berc.berkeley.edu/whose-hacks-hacks-takes-fight-environmental-justice-politics-climate-change/

This year Cleanweb Berkeley hosted it’s 5th annual hackathon, entitled ‘Whose Hacks? Our Hacks!’.  With previous awardees having been in information technology for flexible demand and shared solar services (and drought visualizations during the drought), we wanted to challenge participants to explore usually untouched subjects at the intersection of IT + energy and resources: environmental justice and the politics of climate change. The politics of climate change in the U.S. appear unsurmountable, and after a long slow boil, environmental justice has now reached the status of a civil rights emergency. These issues are relevant to the US and elsewhere, and we were excited to see new ideas emerge. Continue reading

Death and Garbage

Progress – what is it? Last summer I started thinking about garbage, and since then I see it everywhere, with the same story being repeated over and over again. While walking through a remote, seemingly untouched, tropical beach of Costa Rica we were awe struck to find plastic debris everywhere. Hermit crabs crawled in and around bags of chips, beer bottles, gasoline containers, plastic dolls, and styrofoam blocks. Washed down the river, thrown on the side of the road, or washed up on shore. Progress, everywhere. Heartbreaking stories ensued. In Ethiopia, gentrification and more expensive living has pushed the poor to unlivable city edges, with a garbage landslide killing 113 dump dwellers in March. In April, a methane explosion collapsed a garbage dump in Sri Lanka, burying a residential neighborhood and killing 28 people. Guatemala, China, and Lebanon have recently seen heaps of trash, plastic, and construction debris killing people, and burying homes Continue reading

Building a Coconut Coir/Soil Moisture Sensor with SMS:

I’ve been wanting to build this for a long time. We have a pretty extensive gardening project going on, and although we’ve installed drip irrigation we’re still using a lot of water. We’re testing a couple of ways to save water, including drip irrigation, coconut coir for soil moisture retention, and now sensors. I went through a few online tutorials what would be helpful in getting things going but many of them assumed some background in networking/setting things up, so I decided to write a tutorial from scratch in case someone else wanted to do this in the future. So, here we go (e-mail me if you have any comments/questions: diegoleonbarido@gmail.com). You’ll need:

  • A raspberry pi3 or 0 (either one is fine, with pi3 you’ll be a little further ahead since it already has gpio pins, you’d have to solder them on the pi0 and buy pins that work for that),
  • 3 male jumper wires like these ones ,
  • 1 roll of lead for soldering like this one,
  • A soil moisture sensor. I bought mine at Sparkun, but there are others out there,
  • SD card with adaptor, and an adaptor in case you have the new Mac,
  • Electronic grade silicone for covering the wires, and
  • A basic soldering kit (the link here is over the top, you only need the soldering iron).
WhatsApp Image 2017-06-22 at 4.51.18 PM

All the materials you need to get a basic analogue soil moisture sensor running

Raspberry Pi Software: We’ll be The first is to make sure that your SD card has the right software for getting everything up and running. We’ll be using the full version of Raspbian (download of raspbian jessie with pixel). It’s a bit of a pain to do this in Mac or Windows (easiest is on Linux), but we’ll get there. Download the image, double click to unzip the file, and you’ll see the raspbian image that you need (for me it was ‘2017-04-10-raspbian-jessie.img’). Now we move on to the terminal:

Diegos-MacBook-Pro:~ diego$ diskutil list

This will give you a list of all your drives. You’ll probably see a “/dev/disk0 (internal)” and a “/dev/disk1 (internal, virtual)”.  Now, insert your sd card into the adaptor and insert that into the Mac sd card adaptor (annoying but necessary, it’s in the buy list above. Now, if you type “diskutil list” again you should see a new drive called “/dev/disk2 (external, physical)”. Check that the size of the drive is the same as the SD card. Now, lets unmount that drive (with [n] replacing the drive where the sd card was mounted (make sure that you copy and paste the correct name of the image you downloaded to avoid any mistakes!):

Diegos-MacBook-Pro:~ diego$ sudo diskutil unmountDisk /dev/disk[n]
Diegos-MacBook-Pro:~ diego$ sudo dd bs=1m if=~/Downloads/2017-04-10-raspbian-jessie.img of=/dev/rdisk[n]

It could take a little bit for the image to be burned into the SD card. When this is finished the terminal will stop doing work. Then just type:

Diegos-MacBook-Pro:~ diego$sudo diskutil eject /dev/disk[n]

Raspbian settings for wifi: Now that the image is burnt on to the SD card we will setup the wifi settings so you don’t have to setup an external monitor or keyboard to do work. One of the extremely annoying things about doing this on a Mac (and without a linux partition) is that when you try to access the burned image on the SD card you will only have access to one partition (the /boot partition) when you should have access to two. So, although there are a few things recommended to solve this problem on the internet many of them seemed a little bit hacky and painful, if you’re doing this as a one time thing go to Paragon Software and download their free trial. Install the software for your OS before proceeding to the next steps (if you proceed without having done something to be able to access your /ext2 /ext3 partitions you won’t get very far). Once the Paragon software is installed, remove and re-insert the SD card with the raspbian image and go to:

Diegos-MacBook-Pro:~ diego$ cd /Volumes

An if you “ls” inside that folder (ls allows you to see all the files inside that folder). For me, without Paragon (or any other strategy to see all the ext2/ext3 partitions) I was only able to see the boot folder, and a couple of other ones such as “Macintosh” “HD MobileBackups”, but after running the software a new folder appeared in cd /Volumes called “Untitled”. Now that we see that file inside the image we go into it and type the following things as follows:

Diegos-MacBook-Pro:~ diego$ cd Untitled
Diegos-MacBook-Pro:~ Untitled $ cd etc/
Diegos-MacBook-Pro:~ etc$ cd wpa_supplicant
Diegos-MacBook-Pro:~ wpa_supplicant $ sudo vim wpa_supplicant.conf

This gets you inside the file where we’ll add the wifi information (note that the ” ” are supposed to be there!). Note the absence of spaces next the =, make your user wifi and wifi password are typed correctly. The text that is in the wpa_supplicant.conf file could change a little depending on country and a few other things, but here is the example of what I had and wrote in mine (here are a few links that detail things that can go wrong when setting up your wifi network: link1, link2)

country=us
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
scan_ssid=1
ssid="YOUROWNWIFINETWORK"
psk="YOURWIFINETWORKPASSWORD"
}

Now, before moving forward go to your /boot partition inside cd /Volumes and create a file inside of it called ssh (you create a file using the command “touch”), as follows:

Diegos-MacBook-Pro:~ diego$ cd /Volumes/boot
Diegos-MacBook-Pro:~ boot$ touch ssh

This last step is important so don’t forget to do it! Some mistakes that I did wrong when setting up the network included: 1)making sure that the password was correct, 2) making sure the  apostrophes I was using were correct (eg., ” vs ” , vim likes the ” straight ones), 3) wpa_supplicant file had the correct info, and 4) Making sure that the configurations on the network are accurate. You might have to edit both your wpa_supplicant.con and etc/network/interfaces files before succeeding, but this should give you a solid push forward. Note: 1) make sure that there are no spaces, and 2) make sure that you save your work in vim (:wq) before exiting.

If you succeeded at all these steps now you should be able to log into your raspberry via your wifi network! Now let’s try it. Remove your SD card and adaptor from your computer and plug the SD card into your raspberry pi (make sure the pi is turned on!). Wait for it to turn on, and then start looking for a connection to it. This is how you do it in your Mac terminal:

Diegos-MacBook-Pro:~ diego$ nmap -sP 10.0.0.1/24

This will print out a list of IP addresses where you might try to connect with:

Starting Nmap 7.50 ( https://nmap.org ) at 2017-06-23 11:04 PDT
Nmap scan report for 10.0.0.1
Host is up (0.0093s latency).
Nmap scan report for 10.0.0.2
Host is up (0.016s latency).
Nmap scan report for 10.0.0.6
Host is up (0.0090s latency).
Nmap scan report for 10.0.0.17
Host is up (0.00087s latency).
Nmap scan report for 10.0.0.25
Host is up (0.084s latency).
Nmap scan report for 10.0.0.27
Host is up (0.057s latency).
Nmap scan report for 10.0.0.46
Host is up (0.0068s latency).
Nmap done: 256 IP addresses (7 hosts up) scanned in 8.54 seconds

You’ll have to try going one by one to each of these IP addresses until you find the pi (if you get a security warning just reply Yes, it will only ask you this the first time you’re connecting to it. The way you’ll look for the pi is by typing in the terminal (with [n] being the IP address that you’re trying to connect to):

Diegos-MacBook-Pro:~ diego$ ssh pi@[n]

In this particular case ssh pi@10.0.0.46 is what worked for me, and then it asked me for a password (pwd: “raspberry” — without the apostrophes!). This should let you log in to the pi. If you’re successful it will be evident as your terminal user will change to (pi@raspberrypi:~ $). If you’re not successful in getting this, you need to check your wpa_supplicant.conf files (in the Linux partition, or however it is called in your computer) and the /boot partition. Every time you move the SD card from the raspberry pi to your computer the wpa_supplicant.conf file is changed by the pi so you’ll have to retype what we did above (make sure you save in the text file as work through things so it’s easy to copy and past) inside the wpa_supplicant.conf. The pi also deletes the “ssh” file inside /boot, so make sure that you go through the motions for wpa_supplicant.conf and touching ssh into boot before checking the wifi connections. This can be a little tedious and little mistakes can happen along the way so be patient!

Hardware: When you eventually manage to connect to the pi successfully, it is time to begin with the actual work. First, I would suggest creating git repository for your project and cloning into your pi so you can keep track of changes and you can easily track your work. As follows:

pi@raspberrypi:~ $ git clone https://github.com/yourusername/thenameofyourrepository.git

Then, install all the software and updates you’ll need to work on your project. Check here in case I forgot anything but this should have you covered for now:

sudo apt-get install vim #text editor that doesn't come in the pi
sudo apt-get update #important update for working with the pins
sudo apt-get upgrade #important update for working with the pins
sudo pip install twilio #important for sending SMS later on

After doing this we should be able to start playing with the pins! Before moving further lets take a look at the following sketch so that we wire things properly:

pins

GPIO pins

For us, and looking at the labels in the soil moisture sensor will be connecting: 1) VCC –> 3v3 (Pin 1), 2) GND –> GND (Pin 9), 3) SIG –> GPIO 17 (Pin 11). So, before soldering anything together lets make sure that we are getting a signal (let’s pretend like in the picture below nothing is soldered together). Your cables are touching each of the holes of the soil moisture sensor and that you’ve connected each of their ends to the appropriate GPIO pins as I just indicated:

WhatsApp Image 2017-06-23 at 11.44.19 AM

I soldered this already, but imagine that the metal is just touching each of the holes and female portion of the wire is going into the appropriate GPIO pins.

Now, to see if we’re reading data lets go inside the pi’s python and look into what the pins are reading! Before going further I suggest you look into this quick introduction to python’s GPIO library as it will come in handy in the next few steps:

pi@raspberrypi:~ $ sudo python

and inside python lets import the libraries we’ll be using:

>> import RPi.GPIO as GPIO
>> from twilio.rest import Client

To test whether we are reading any data, grab a glass of water and dip the soil sensor and dip it in and dip it out. While you do that write the following code to establish what will be our input pins and whether or not we’re reading data (this particular soil moisture sensor is analog, so we’re only getting 0 and 1 values). Note that we’re making pin 11 our input pin:

>> GPIO.setmode(GPIO.BOARD)
>> GPIO.setup(11, GPIO.IN)
>> print(GPIO.input(11)) #When outside of the water this should print 0
0
>> print(GPIO.input(11)) #When inside of the water this should print 1
1

WhatsApp Image 2017-06-23 at 11.44.18 AM

Dip the moisture in and out of the water while printing the input fro gpio 11 as indicated above.

If this is not working make sure that all the libraries are installed and that you’ve connected the wires to the correct pins. It might take a little patience, but you’ll get there. Now, if you are successfully reading data lets go into the SMS part. Open an account with Twilio, buy a phone number, and make sure that in the Twilio settings you copy the “account_sid”, “auth_token”, and the phone number you just bought. Once you have this information it is really straightforward to write a script for checking soil moisture (1 or 0) and sending us a message when the soil is dry. Copy and paste the following script into a new python file (e.g., soil_moisture_sensor.py) and save it in the git folder you create. Mine looks like this:

import RPi.GPIO as GPIO
from twilio.rest import Client
#Twilio setup
account_sid='YOURTWILIOACCOUNTSID'
auth_token='YOURTWILIOAUTHTOKEN'
twilio_number='+1THEPHONENUMBERYOUBOUGHT'
client = Client(account_sid,auth_token)


#GPIO Pin setup
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN)
print(GPIO.input(11))


if GPIO.input(11) == 0:
message = client.messages.create(
to= "+" + str(THEPHONENUMBERWHEREYOUWANTTORECEIVEMESSAGES),
from_=twilio_number,
body="Hello, it's the coconut :) please water me today!")

This should work and you should have received an sms saying “Hello, it’s the coconut :) please water me today!”. If you didn’t check your twilio settings and make sure that you copied all the settings correctly. Now that everything is ready, let’s solder the wires, and apply some silicon (or hot glue) on top of them so that they don’t move. The final step will be to create a crontab job so that this script runs every day checking when you’ll need to water the coconut. The final snippet of code for the crontab job is after this image:

WhatsApp Image 2017-06-23 at 11.44.20 AM

Soldering wires together.

To run this script on crontab you’ll  use the following code (note that I’ve let this be in UTC time, you’ll have to change the pi settings if you want to use your local time). Here is a short intro to crontab:

pi@raspberrypi:~ $ crontab -e #this will let you access crontab

Once you’re inside crontab just copy and paste this code (change the name of the .py if you used a different name). This crontab runs at 7.30 am every day and will only send me a message when I need water. Just edit crontab with vin and you’ll be good to go:

0 14 * * * cd soil_moisture_sensor; python read_soil_data.py

WhatsApp Image 2017-06-22 at 4.56.00 PM

A happy lettuce will grow from here at some point!

References:

http://www.macworld.co.uk/how-to/mac/how-to-set-up-raspberry-pi-3-with-mac-3637490/

http://makezine.com/projects/tutorial-raspberry-pi-gpio-pins-and-python/

https://www.modmypi.com/blog/raspberry-pi-plant-pot-moisture-sensor-with-email-notification-tutorial

https://www.modmypi.com/blog/tutorials/raspberry-pi-plant-pot-moisture-sensor-via-analogue-signals

https://github.com/modmypi/Moisture-Sensor/blob/master/moisture.py

https://github.com/sparkfun/Soil_Moisture_Sensor

http://makezine.com/projects/tutorial-raspberry-pi-gpio-pins-and-python/

https://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/

SWITCHing to a Low-Carbon Future

IMG_1952

By Diego Ponce de Leon Barido and Josiah Johnston

Re-Post from National Geographic: http://voices.nationalgeographic.com/2016/02/24/switching-to-a-low-carbon-future/ 

Rolling black outs and high electricity prices were a common ritual in Nicaragua a decade ago. Schools and shops often languished for hours without power. Hotels and restaurants relied on kerosene, candles and expensive generators to keep businesses open. From a financial and health perspective, this was not sustainable. Continue reading