# Can my Tesla Model S be charged daily by the Solar on my roof?

Note: I don’t actually own a Tesla Model S and all I really care about is honesty. I want this question answered honestly so that people can stop lying to each other.

I was reading a brilliant post that pretended that the Electric car had been released first and that the Petrol car was trying to attract its first buyers; I highly recommend that you read that article. But the whole article raised one really important question about how much energy it would take to run your house and car on solar. In it’s distilled form the question is essentially:

How many Solar panels and Tesla Powerwalls would I need to take my Household energy usage and Tesla Model S off the grid? (Such that I don’t need to rely on the Grid and fossil fuels ever again)

To fill in that spreadsheet you only need two pieces of information:

• How much energy your home consumes per day (in kWh).
• How much you drive per day (in km)

With that information you can work out how many solar panels you would need on your roof and how many Tesla Powerwalls you would need to store all of the energy that they generate. I think that you should give it a shot.

However, my conclusion is this: most people that drive close to or under the average for Australian drivers (<= 43km per day) will find that they don’t need significantly bigger Solar Systems and power packs to cover the costs of their Tesla car. And every single home owner on the planet should be able to get enough Solar panels and Powerwalls to cover their household and car energy usage.  Good news!

Note: Currently there is no cost analysis here of how much those components will cost. But I will add that companies like Solar City and Sun Edison make getting solar panels a breeze. Also the Gigafactories being build in America right now should dramatically bring down the price of Solar Panels and Powerwalls.

Hopefully this helps somebody and, if you have any questions then please let me know in the comments.

# Making a printable Cam

In this post we are going to explain the process of making a 3D printable Cam with OpenSCAD and a little bit of code I wrote.

In a nutshell, the code I wrote takes in a standard displacement diagram used to describe the increase and decrease in displacement of a Cam over time. Something that looks like this:

And uses that information to create a 3D model like this:

A cam on a cylinder (known as a disc cam).

A cam on a ramp (also known as an end cam).

If you don’t know what a Cam is then please read the previously linked Wikipedia page. But just because you know what it is does not explain why you would want to make one.

A Cam is an device that turns rotational motion into linear motion an many different ways; this is extremely powerful. In mechanical engineering is is pretty easy to create rotational motion (Electric Motor, Steam, Windmill, Treadmill with mice, etc). This is great and already useful but, in many cases, we then want to perform some kind of linear movement based on this rotation. For example, maybe we want to use the rotational motion to trigger a button a certain number of times per second (like an odometer). In this scenario the rotational motion needs to be turned into the linear motion of pushing the button up and down. This conversion is extremely useful and almost every modern petrol based engine uses a Cam via the aptly named Camshaft; the thing in your car which make the engine pistons go up and down.

However, I am personally very excited by the combination of combining a cam with a spring follower. This allows you to slowly store more and more energy in a spring and then release it all at once explosively, letting you create an automatic catapult. For a rudimentary example of what I mean please see this olive slinging device:

So, with that in mind I wrote a quick program in OpenSCAD to generate Cam for you. At this point in time you can generate two different types of Cam’s: a disc cam and an end cam. The two methods that allow that let you specify:

• The displacement diagram of the Cam
Given as a list of points from (0, 0) -> (1, 1) with linear interpolation between the points and points that retain the same displacement to infinity on either end of the diagram.
• The number of segments
Ultimately the Cam will not have a smooth surface but rather be built from a number of segments. The more segments then the more precision your Cam will have and the smoother the finish will be
• The dimensions of the Cam
How high should it be? How big should the radii be?

Lets run through a quick example to show you how it works. With these variables under your control you can then write openscad code that looks like this:

```end_cam(displacement = [ [0, 0], [0.2, 0.8], [0.6, 0.5], [1, 1] ],
segments = 360,
baseHeight = 1,
peakHeight = 3,
width = 0.5);
```

And it would produce a Cam that looked like this:

And here is an even more complex example where we made the displacement diagram be the (sin(x)) ^ 2 function.

```[ for(i = [0 : 360]) [i / 360, sin(i) * sin(i)] ]
```

It looks great:

An edge cam generated with the sin(x) ^ 2 function.

And this is very very powerful, you can now create a cam for your own hobby purposes. Here is the full example of test Cams that you can view just by loading up the test-cam.scad file that exists in the source code:

If you wish to add extra fixtures to the Cam’s so that you can attach them to your motors or rotating mechanical devices then the union and difference functions from OpenSCAD are your friends. Good luck. I hope that this helps you on your mechanical endeavours and please post your creations made using this code in the comments section below. I can’t wait to see them!