The scope of the OpenRISC project is so extensive that it covers wild range of areas including processor architecture, implementation with register transfer language, simulation tool, synthesis tool, and tool-chain SDK. It is hard to believe the OpenRISC community behind this project has been able to put together the tremendous amount of efforts to successfully implement each single component, creating a valuable, well-performing, but free soft CPU for anyone to use.
As a newbie into this area, I quickly drown myself in the ocean of its ecosystem. Don’t worry if you are too, getting lost in the terms like IP core, fuseSoC, or1k, tool chain or openOCD. I spent quite a lot of time to sort out what role each of them plays in the big picture.
Instead of jumping into the details of them, I would rather show you how to quickly make it work on a de0-nano demo board. This way, I hope you will gain some confidence before burying yourself into much deeper pain.
First of all, you need to have a Linux machine to start with. Sorry, this is a must, especially you start from scratch. Once you have created a project with fuseSOC, you can move to Winodows with no problem.
Then you will need the de0_nano development kit from Terasic. This board is officially supported in the OpenRISC tutorial. That means – you don’t need to change a single line of code to implement the CPU on this FPGA board.
Before you move on to the next command, you need to install the Altera Quartus IDE, as the FPGA on the de0_nano is Altera’s Cyclone IV E series. Make sure you have your Quartus bin folder in the path by adding the following line at the end of the ~/.profile.
Go to the folder tools/fusesoc/bin and run the following command:
fusesoc build de0_nano
So what happens next is fuseSoC, the awesome IP management program, will automatically put together all the necessary verilog HDL files and generate a Quartus project for the IDE software to compile. As a result, the Quartus will produce a SOF file for you to configure the FPGA on the de0_nano board. This process will take a quite while, you will see hundreds of lines of compile message print on your terminal.
If the build finishes without error, then you can run the build on a de0_nano board by:
fusesoc pgm de0_nano
Make sure your de0_nano board is connected to PC with a USB cable. You will notice that the JTAG indicator on the board will stay on during the programming. Once the FPGA is successfully configured, you should be able to see the onboard 8-bit LED indicators shifting from one to the next.
I assume you run all the above codes on Linux platform, you may run into errors as below:
To be honest, it is a little odd that PHP session won’t be destroyed after Apache server got restarted. In order to truly kill the PHP session, especially during development, I created a piece of following code, and ran it everything I wanted to have a clean start:
Computer vision cameras come with extremely small size without too much compromise on image quality. They fill in the holes of a wide range of applications that conventional photography cameras are not capable of.
One drawback, however, is the fact that they don’t have large on-board storage. That is to say, the data must be streamed out to some external storage. A dumb computer could be a good company for the computer vision camera, but this combination will cost the computer vision camera its advantage of size. Image that if you want to build a computer vision camera rig, then a large of computers will be required, which is very likely to make the maintenance work become nightmare.
Given the fact that those dumb computers are only there to receive and store the data, with no need to all the advanced stuff such as CPU computing power or graphics performance. In this case, is it possible for those super cheap single-board computers (embedded system) to take over the job? The good news is, YES!
According to Point Grey’s website, they’ve already tested their cameras with single-board computers such as Jetson TK1 from Nvidia and ODROID-XU. How about others, the popular Raspberry Pi or Banana Pi? Especially the latter one because it comes with a SATA port, perfect for a SSD storage.
After downloading the ARM SDK and the sample codes into the Banana Pi, the first tryout gave me the following error:
There is an image consistency issue with this image
What does it mean? It means your data receiving part (which is the Banana Pi) can’t catch up the speed with the camera. So the image you received is likely corrupted.
How to solve it? Fortunately, you only need to tweak the parameters on the camera as well as the OS (e.g. Ubuntu) on the embedded system:
Packet Size and Delay on the camera
Receive Buffers on your OS
I will take a little bit more in my next posts regarding tweaking of those parameters. Once I got everything work, I was able to achieve 4fps of the RAW data from its 5.0 MP sensor, that is roughly 80MB/s. When I tried to increase to 5fps, I got the “image consistency issue” back from time to time. I believe there still should be a little more juice to squeeze out of the Banana Pi by tweaking the above parameters.
It is quite different from populating a bare circuit board because the board comes with all types of other components. Rework process is more to fix a problem than to create new damage, so I will need to focus on the target LED only, not to affect other ICs. The LED is from Philips Luxeon Rebel series, about 3mm x 5mm in size. The pads for soldering are on the bottom of the component, making it impossible to solder with the traditional soldering iron
Heat gun is a great tool for this purpose as it is good at spot heating. With proper procedure and handling, the removed LED might still be reusable.
Stencil, unfortunately, couldn’t be used in this situation to assist the solder paste applying process. However, thanks to the surface tension, manually applying the paste onto the solder pads still work for this job. Don’t worry if they look messy at the beginning.
The first impression of the Ricoh Theta 360 Degree Spherical Panorama Camera is its odd appearance — to me it feels like a bar of chocolate wafer. The dual lens reminds me of the bubble eye goldfish. For some reason I was given this 1st generation Ricoh Theta camera for free, but broken. So why not taking a peak at its inside?
The camera was wrapped with aluminum straps by double-sided tapes to cover the screws. Removing the straps would expose the screws. And that would be the starting point for the teardown.
There were quite a few screws on the sides. Once they were all gone, the cover popped up easily. Now you can see what’s enclosed: battery; circuitry and optical module. Looks like each section takes equal amount of space inside the camera body.
The Li-ion battery (model: DB-100) is quite beefy, to be honest. It is actually a Ricoh’s standard rechargeable battery product, which is also being used on CX5, CX4 and CX2 cameras. No wonder it looks a little over-sized for the slim panorama camera. I guess Ricoh could cut down the cost by doing so.
Panorama camera is equipped with a RS-WC-201 wireless module from Redpine Signals. This module supports 802.11b/g and single stream 802.11n, up to 65Mb/s. Retail priced at about $65.00USD from Mouser. Same feeling for the battery that it is also quite big….but off-the-shelf means lower cost, why not?
Unplugging the wireless module will expose the mother board and the optical assembly. The optical assembly, featuring two big fish-eye like lens in a back-to-back configuration, is well sealed and weighs a lot. A metal strap was wrapping around the lens, and was soldered on to the mother board through black jump wires. I guess that was some sort of anti-static protection since the camera design made it very likely for a user to touch the lens. Although the lens is a passive component, prone to electrical discharge, the enclosed image sensor (I will show you later) may get affected if the lens takes the charge.
The mother board is actually bigger than my first glance. It goes under the battery, covering the whole body except for the lens area.
Another interesting discovery from the back of the mother board is that the Theta camera is utilizing a 4G micro SD card as extra storage.
A piece of metal shield covers the ARM processor and the memory chip. The ARM processor is Fujitsu Milbeaut Image Processor MB91696AM, equipped with a dual-ARM core and built-in H.264 codec that supports Full HD video. This processor seems to be 4~5 years old already, its maximum of 5.5fps at 20MP doesn’t look too fancy on today’s market. That’s probably part of the reasons why Ricoh has released a new generation: Ricoh Theta S. The memory chip from CHIPSIP model CT49248DD486C1 is NAND(1Gb)+DDR3(2Gb). So my question is, if the storage size could be easily increased by using a bigger NAND chip, what is the necessity for an add-on micro SD card? Maybe it is easy to make models for different memory size?
The Xilinx Spartan-6 FPGA, the dual-core ARM processor and the memory chipset make the image processing engine for the Ricoh Theta camera. What makes it different from all other cameras is the unique optical/image sensor assembly that is capable of capturing 360° panorama photo.
I took the photo below as I though this would be the end of my teardown work of the Ricoh panorama camera. But I was wrong! Please read on as more interesting discoveries are ahead about the well engineered optical / image sensor assembly.
The two circuit boards on the top and bottom of the optical assembly are actually the image sensor boards. I didn’t realize this until I further tear down this assembly. It was hard to image how a sensor is not directly behind a lens, but on the side looking through a diagonal mirror. What a smart design! Since the image sensor is no long taking up the space behind the lens, the back-to-back dual fish eye lenses could get as close to each other as possible. This, presumably, will leave a smallest as possible seam between the two 180° panorama photos. I guess this would make software engineer a much easier job to stitch the photos.
The optical / image sensor module was so well packed that it took me and my colleague some serious efforts to open it up. I noticed that some glue was used for the packaging, so the teardown of this assembly is an irreversible process. It was causing permanent damage to the assembly. So think twice before you try this.
The image sensor got knocked off first. I wasn’t able to tell its maker or the model number. Given the limited number of pins on the connector, I guess it is a rolling shutter sensor.
Once the sensor was removed, I was able to prove my assumption of its right angle optical path. As you can see from the photo below, I shined some yellow light on the right side, and the color showed up on the top. Same thing happened on the left side where the image was reflected down. There must be some sort of double-sided mirror placed in diagonal direction.
After the out-most convex lens was gone, we were able to take a further step into the heart of the optical module. But we were stopped by another piece of lens.
After another desperate digging, knocking and poking, the 2nd lens was finally gone. And the core of the optical module was just a friction of an inch away.
Finally we were able to grab the core: a beam splitter like cube that is made of two prisms glued together, forming a double-sided mirror on its interfacing surface (45°).
Here is the photo of all the parts that were ripped off from the optical / image sensor assembly.
I’ve decided to decorate the sliding gate with fencing board from the very beginning. Now the posts were set, the gate was assembled, and the gate opener was installed and powered. Finally, it’s time to start mounting the fencing boards to finish this project!
There are many different ways to mount fencing boards on round steel pipes. The two most common ways shown in the photo below, however, wouldn’t work for me. I couldn’t mount the boards flush against the frame pipes because the cantilever roller will need to roll on the horizontal pipes. Nor would I cut the boards shorter to avoid protruding the top & bottom frames because I wanted to use full 6 ft length of those boards. This way, I will be able to keep the sliding gate same height as the neighboring fence.
My idea solution would be mounting the boards a few inches away from the gate frame to allow free rotation for the U-groove rollers. The fencing boards, or the top/bottom rails still attach to the frame, but not flush against the it. This will keep the top and bottom pipe clear of any obstacles for rollers. The photo below show how I spaced a few inches between the gate frame and the fencing boards.
The key elements here are some home-brew brackets that were welded on the gate frame, but not touching any area of the very top or very bottom of the gate frame.
Finally, it’s time so say good bye to the old gate!
There is a wide selection of gate opener products available online or at local shop, The price would range from several hundred dollars to more than a grand. It is really hard to tell the difference by the appearance. After intensive research on reviews, I decided to purchase the ALEKO AR1450 sliding gate opener with gear rack.
It comes with the kits that meet all my basic needs in my plan:
Two (2) remotes.
Screws and nuts.
Gear lock/unlock key.
20 ft (3.3 ft x 5 pcs) linear gear rack.
Other specs all look fine to me:
Opens gates weighing up to 1600 lbs. — Mine won’t be more than 300 lbs.
Opens gates up to 55 ft. in length. — Mine is about 12 ft in length.
Soft starting / stopping
Gear-driven vs chain-driven
Chain-driven is the most common way to drive a sliding gate, it’s relatively cheaper and easier to install. However, gear-driven mechanism produces quieter and smoother transition. Plus, the linear gear rack looks more attractive than the sagging chain.
Receiving the packages
The first impression upon receiving the packages were heavy, both for the AR1450 opener and the nylon gear racks!
Don’t worry if you couldn’t find the remotes, they were actually hiding inside the opener’s plastic cover. Removing the plastic cover will expose the key components: the giant motor taking most of the space, the circuit board leaning against the motor, magnetic sensor and capacitor. It is not necessary to understand what they are. All you need to do is to wire your power cord to the connector shown in the photo below.
As soon as you get power cords connected correctly, the indicator on the circuit board will light up, and you can immediately control your opener with the provided remote! For tweaks like changing open/close direction, increasing/decreasing force or enabling pedestrian mode, you will need to dig a little deeper into the manual. Other than those, the gate opener almost requires zero effort on the electrical setup. Most of my work, however, was spent on the masonry work — taking measures, assembling mold and pouring concrete for the opener’s base.
Assemble the mounting base and concrete mold
It took me quite sometime to figure out how to assemble the metal mounting base for the gate opener as the manual didn’t seem to be very helpful on this topic. The assembled mounting base looks like a mini oil rig: four anchors shown as below were to be buried in the concrete pouring to produce strong clamping force. Another set of bolts that go straight up are for the gate opener.
If you recall my last post about trenching, you’d probably have noticed that I dug a pretty big hole where the PVC pipe terminated. That hole was actually prepared for the gate opener. A rock solid base made by concrete is very important for the gate opener to provide enough force to move the gate. The hole was about 2 ft wide by 2 ft long, 1.5 ft deep. Since the gate opener was measured to be installed at 8″ above the ground, I made a mold of the same height with width / length at about 1′ / 1’4″. Mold was then installed on the site with proper bracing and supporting to receive concrete.
After I acquired a cement mixer (shown below), my concrete pouring work became so much fun! Before that, I was basically mixing it with shovels….worked fine but not easy. I depleted fours bags of 60 lbs concrete mix to fill up the mold for the gate opener base pad. So total 240 lbs, Heavy!!! Considering the force the motor is going to push on the gate, the heavier base really pays off.
After I removed the mold, I painted the concrete base with wall sealer. Totally unnecessary, but I just happen to have it around. So why not?
Now the concrete pad is ready to receive the gate opener. Make sure the opener is not too far nor too close to the gate frame. Measure the distance by roughly placing a nylon gear rack on the gate. When you are happy with the position, lock the opener with nuts provided. Make sure the opener is tightly secured on the mounting base.
Mounting the gear racks
If my gate were composed of square metal tubes, it would be fairly easy to mount the gear racks — just to place the racks flush against the frame and use self-tapping metal screws to fasten them. However, circular pipes like mine doesn’t provide any flat surface to be flush against. I would have to “create” some.
Looking back into the gate opener kits, I noticed one type of parts that I never realized what to do with before. The small metal bracket shown in the photo below is actually a piece of perfect gadget to “create” such flat surface for the purpose of mounting the gear racks on round pipes.
In order to “create” such flat surface, I would need to weld this bracket on to the pipe. Since I welded the whole gate frame together, this small task wound’t be a challenge for me any more.
I still don’t know if I am making correct use of those brackets, but they do look perfect for this purpose. The bracket has a open slot in the middle, so I could easily adjust the height of the gear rack. Here is the final assembly of the gear racks on those brackets, and I connected four racks together to make a 12-foot long continuous gear rack.
This ALEKO AR1450 gate opener relies on magnetic limit to control the stop of the gate. Basically the magnetic limit is mounted on the gear rack, when the sensor inside the opener senses the passing magnet, it will trigger the stop operation of the motor. Two sets of magnet / brackets are provided in the kits: a taller one for gate open limit; a shorter one for close limit.
Note that the gate won’t stop immediately when it sense the magnet, the control circuit inside the opener will ramp down the rotation of the motor. When choosing the location for the magnet limits, make sure leave some buffering distance before the gate completely stops. This is very good design of the gate opener to have the ramp up / ramp down mechanism. Without it, the abrupt start or stop will result in tremendous momentum on the gate frame, gate opener and posts, just like the gate is actually crashing on the gate opener every time it starts for stops moving. Frequent crashes day after day like this will eventually break the gate and the opener.
[Edited on Mar 28th, 2016]
In case you would like to know more details about wiring the AR1450 mother board, please refer to the following image that came with the product.