The Wheelie Bin Project

 

About this Project

This is a custom made project for an artist. The end product is a “Piece of Art” and it was dysplayed for the first time at FRAC Champagne-Ardenne in Reims, France.

The requirements for this project were given to me verbally by the artist himself.

He needed a wheelie bin train, a train formed by empty bins. The train was supposed to run on a closed loop railway.

The requirements for this project were:

1.      To build the locomotive

2.      To provide obstacle detection capability in order to stop the train if people are present on the railway.

3.      To provide remote controllability in order to stop/start the train remotely.

4.      To finish the project in three months.

            At the beginning I found this project quite difficult mainly because of the time limit set for this project.

Project details

The project is mainly divided in three parts:

            1 – Finding the solution 

            2 – Designing and building the prototype

            3 – Building the final solution

1 – Finding the solution

 a) The motor and the motor control device

After a well documented investigation I decided that the best approach is to buy a second hand Mobility Scooter of ebay.

I bought this Mobility Scooter for 122 GBP

Mobility Scooter

            This approach saved me time, money and reduced the risk implied with building the mechanical and electrical part of the drive shaft.

As I bought the scooter I had to find out how the scooter works and how I could interface the scooter with the uC. Basically, I had to find out a way in which I could control the speed of the motor through the uC.

I tested the scooter

Testing the scooter

I disassembled it

Drive shaft (DC motor, gear box, control unit)

            It was the time to figure out how it works!

I learned that there is a mechanical 5kΩ potentiometer with the cursor forced at the middle point by two springs. The speed reference is given by the driver either by displacing the cursor to the right for positive speed or to the left for negative speed (reversing). I figured out that to interface the scooter with the uC I need to simulate the behavior of the potentiometer through the uC.

I understood that this potentiometer works as a voltage divider, and the control circuit takes at the input a voltage as a speed reference. Because it is relatively easy and cheap to generate a variable voltage using a uC through a PWM output, I removed the potentiometer and I tried to apply a variable voltage but for some reason this didn’t worked. Then I realized that the only solution to quickly interface the scooter with the µC is to find a digitally controlled potentiometer. After a quick search I found out that there are plenty of digital potentiometers available on the market. After reading trough few datasheets I noticed that most of them could handle 5V on the potentiometer pins and the current handling capability was a few mA. In order to get a match with my mechanical potentiometer I checked the voltage drop on it which was around 13V and the current trough it was around 3mA.  There were just few potentiometers on the market which would fit my need. These potentiometers were from Analog Device. I picked two of them (AD5260 and AD5290) and I asked Analog Devices for some samples. I got the potentiometers few weeks.

Searching for a way of controlling the shaft speed through the uC

Hacking the scooter control unit

b) Obstacle detection

As I needed a way of detecting any possible obstacles which could appear in the front of the train I thought that the quickest and fastest approach to this is to buy and modify a car parking kit.

This is the parking kit that I brought of ebay for aprox 15£:

Parking sensor kit

Testing the parking sensor

Parking sensor accuracy test

   .

Parking sensor display

Distance to the obstacle

I investigated the obstacle detection capability, reaction time, consistency, maximum distance detection, minimum distance detection

Obstacle detection capability – experiment setup

            I found out that the sensors don’t work as I expected. The display went off from time to time, the distance detection was slow whit big oscillations around the actual distance.

c) Remote controlling

One of the project requirements was to remotely start and stop the train. I checked different radio receivers and transmitters on Farnell but at the end I decided to buy the following car Remote Central Locking kit. This decision was a bit risky because it didn’t came with a datasheet and I had to work out how it works and how I could interface it with my system, but I thought that for 12£ it’s worth trying.

Remote central locking kit

Decoding the remote

In order to find out how the remote central locking works I disassembled the transmitter and receiver and I started to identify components. The receiver had several ICs. I identified the controller, some op amps and the radio receiver side. The transmitter had only one integrated circuit, it took me a while till I found few different datasheets for it. The only problem with this datasheets was they were in Chinese. I tried again and again to find an English version of the datasheet but I just couldn’t find one, so I realized that if I really want to decode and understand the transmission I had to use what I had.

I returned to the Chinese datasheets and I was lucky because the numbers and the waveforms in Chinese are the same as in English. I remember trying to see if there is relation between tables and waveforms by looking if there are the same Chinese letters in tables and under the waveforms. After few hours I managed to understand the logic of the code and to decode the transmission. I was so excited. I was pleased with my achievement but on the other hand I realized that this type of remote central locking is not that secure as it is advertised.

Setup used to understand and decode the Remote kit

d) Signal/decision processing

I chose the PIC18F4550 uC for this project. This uC is oversized for this job but it is a popular uC from microchip which makes it more accessible.

A brief description of the used uC PIC18F4550

  • No. of I/O’s: 35
  • Program Memory Size: 16 kWords
  • EEPROM Memory Size: 256 Byte
  • RAM Memory Size: 2048 Byte
  • CPU Speed: 48 MHz
  • Peripherals: ADC, Comparator, PWM, Timer
  • Flash Memory Size: 32 KB
  • Interface Type: EUSART, I2C, SPI, SPP, USB

2 – Designing and building the prototype

a) Schematic and layout

I didn’t know exactly how I will interconnect all the elements of the system together. That’s why I needed a prototype on which I could test different ways of interconnecting the different parts of the system. Based on my experience it is really important to have a prototype to work on. Also a prototype is the key for a clean and tidy final product.

The prototype control unit, as you can see in the following schematic, it is designed around the PIC18F4550 uC. The prototype control unit contains:  the power supply, the clock circuit, the digital potentiometer AD5290, few LEDs and push buttons. All this resources are routed to pads, this allowed me to manually connect different resources to different pins of the uC.

Schematic of the prototype control unit

The schematic is also available for download in pdf format here.

            This time I chose KiCad, a free tool, to design the schematic and the layout of this project. At the beginning I found this tool quiet difficult to use, there were things that I just couldn’t figure out how to do them, and those things were driving me crazy. I had to read manuals and search on forums. But, at the end, after I got used with it  I found it quiet handy and strait forward.

The layout is manually routed and you can clearly see the pads which basically allowed me multiple combinations without damaging the board.

Top layer of the prototype control unit

Bottom layer of the prototype control unit

b) Building the prototype board

I have already described the steps for obtaining the PCB in my previous project USB temperature data logger. This time I will keep it simple by presenting only pictures which I took along the building process.

Overlapping two foils for an enhanced contrast

 The PCB board after being exposed and developed

 The PCB board after being etched

 It’s just me – soldering the SMT components

c) Testing the prototype board

The hardest part after you built a new board especially around a new uC is to make a LED flashing. I am always amazed about how much satisfaction could provide me a simple flashing LED in this situations. If you have a close look at the following image and you will compare it with all the others you will realize that I didn’t had this satisfaction strait away. Once again something went wrong. It was so frustrating. How could a board whit just few components on it not to work? It took me a while till finally I found out what went wrong. During one of the nights when I designed the footprint for the crystal oscillator I have somehow missed the text “bottom view” in the crystal oscillator data sheet. That’s why in all the pictures except this one you can see the crystal oscillator flipped over.

First trials of the prototype control unit PCB

d) Testing the digital potentiometer

As I managed to get the first LED flashing I moved on and I connected the digital potentiometer AD5290 (the other small IC on the PCB) to the uC.

I read the AD5290 datasheet and I developed a simple piece of software which automatically set a preprogrammed value in the digital potentiometer at the power up. After some trials and adjustments the software was finally doing what it should do. At this point I could say that I was able to digitally control the potentiometer. Then I slightly modified the software to be able to adjust the potentiometer value through two pushbuttons, one to increase the value and  one to decrease it.

When all this was done I took the following picture and movie:

The digital potentiometer controlled by the uC

Digital potentiometer controlled by the uCUp/Down buttons

e) Interfacing the digital potentiometer with the mobility scooter

This should have been a straightforward approach but unfortunately wasn’t. Because according to my initial measurements on the mobility scooter control unit one of the potentiometer terminals was connected to ground and I designed the prototype board with one terminal of the digital potentiometer connected to the ground. I later found out that this wasn’t true and I had to cut the track from that terminal to the ground. After I did this change everything worked just perfect. I was excited.

The Interfaced digital potentiometer with the mobility scooter

Digital potentiometer interfaced

f) Remote control testing/decoding

As I have already identified most of the ICs on the receiver and transmitter PCBs I played around with the scope till I found the same signal on both boards, the transmitted signal on the remote PCB and the received signal on the receiver PCB. By finding the same signal on both boards I knew that I actually have found the transmitted signal. Now that I had the entire transmitted waveform and a Chinese datasheet, the task was to find the logic of the waveform (transmision).

Remote control testing/decoding

Setup used to test/decode the remote control

The decoded remote – a segment of the binary code can be seen in background

g) Remote control interfacing

Now that I understood the waveform and I had the binary code it was the time to write the software, for the uC, which will interpret the waveform and use the binary code. The process of identifying the waveform by the uC is a time consuming task. For a smooth operation I had to implement the remote decoding part interrupt driven.

I connected the received signal to one of the uC input which had interrupt on change capability. After just few days of codding the decoding software worked well and I was able to turn on and off LEDs on the prototype board remotely by pressing the buttons on the remote. It was nice and I had a pleasant filling of success it’s like when you work hard and finally it’s working. But as always the satisfaction was short.

I wanted to check from how far my remote work’s. I was really amazed when I noticed that my remote works only in an area of 2-3 meters around the receiver. Something was wrong and I worked so much for something which wasn’t really working. I remember that I was so bothered that I couldn’t even sleep. When I investigated the issue I noticed that the amplitude of the signal (waveform) falls with the distance between the receiver and the transmitter. Beyond a certain distance the signal wasn’t high enough for 1 logic and therefore I could not use interrupt on change to read the code (waveform).

I knew that I can overcome this issue by inserting a voltage comparator in the schematic. But adding components it is not something that I like to do. Usually if it is possible I prefer to write much intelligent software instead of adding components. I knew that my uC has a built in comparator, I checked the datasheet and the uC had comparator interrupt capabilities. I was on the track again. I did substantial changes to my initial code to adapt it to the new input type, and finally it really worked this time. Once again my prototype board proved to be really useful. I didn’t had to cut tracks, I just unsoldered the wire form the interrupt on change driven pin and I soldered it to the comparator input pin.

            In the below picture you can see the pink wire connected between the remote control receiver board and the uC comparator input.

Setup used for the remote control interface software development

            By adding few more lines to the uC software I was able to fully control the speed of the shaft in 255 steps by just using the remote control.

Shaft speed controlled by the interfaced remote control

h) Parking sensors interfacing

After I investigated the parking sensors boards I concluded that I could interface the parking sensors in two ways. I could interface by decoding the digital signal between the main board and the display board and use the distance information, or by using 7 inputs of the uC to check how many LEDs are on and compute the distance this way. The last method appeared to be straightforward and easy to implement in software. The main drawback was that it was consuming 7 input pins of the uC. For some reason I wasn’t to keen to implement none of this ways of computing the distance. I was concerned that maybe the final user will need to adjust the distance at which the wheelie bin will slow down/stop. I thought that I needed to find a way in which the final user would be able to easily change this preset values without firmware upgrade. It took me a while till I came up with the final idea on how I should interface the parking sensors in order to provide user adjustable preset points. I had the idea that I could use just 4 inputs of the uC and use a jumper based selection board and basically the user would be able to connect any LED trough the jumpers to the uC imput. In this way a start/stop, speed up/slow down control with distance based hysteresis could be easily implemented. I thought that this approach will ensures a smooth functionality.

The parking sensor display which I had to interface was a 7 segment type display and I knew that on this type of display the information is displayed in turns on each individual 7 segment display at a time. The inertia of the LED combined with the speed of perception of the human eye makes us to see all the 7 segment elements lighted up at the same time.

In this particular case of the parking sensor display the two LED bars (left and right) where multiplexed together with the 7 segment display. Therefore the only way in which I could extract the information was to connect the circuit strait in parallel with the bar LEDs.

The below picture contains the waveform measured on the LED (+resitor).

Waveform measured on the parking sensor display LED(+resistor)

            In order to interface the parking sensor with the uC I had to carefully selected an optocoupler to not affect the normal functionality of the LED with which the optocoupler was connected in parallel. I knew that the flickering effect will be transmitted trough the optocoupler to the uC to overcome the flickering effect I designed by simulation a filter. I quickly drew the following schematic. The transistor is the output of the optocoupler, and in the real case it is controlled by the optocoupler LED.

 Filter designe-simulation schematic

            I wanted that the output of the filter to be 1 (or 0) logic, if there was signal at the input (the LED was on) and 0 (or 1) logic if there wasn’t signal at the input (the LED was off). Therefore I checked the voltage laves values for 1 and 0 logic in the uC datasheet. After which I adjusted the two resistors and the capacitor value till I got a acceptable response.

The simulation waveform is presented below.

Filter design – waveform obtained with the above schematic

            From this simulation you can see that the reaction time when the train approaches an obstacle is low and it is high when the distance to the obstacle increases. This approach allowed me to accurately detect when the train was approaching an obstacle (distance decreasing – LEDs turning ON one by one); when the obstacle suddenly appeared (distance becoming minimum – all LEDs ON together); when the obstacle was moving away (distance increasing – LEDS turning OFF one by one) or when the obstacle was suddenly gone – all LEDs OFF at the same time).

As I was satisfied with the simulation of the filter I built the filter and I interfaced the parking sensors with the uC. In the below picture you can see the setup used to develop the part of the uC software responsible with the distance detection. In the top-right corner of the picture is the filter + jumper selector board; in the bottom-right corner is the parking sensor display and in the top-left corner you can see a fraction of the parking sensor control unit board.

Setup used to develop the distance detection software

Proving the distance detection functionality

The interfaced parking sensor

i) Testing the prototype

At this stage all the parts were put together and the system was functioning well. Basically I had finished the research and development stage.

The setup as it looked at the final of the prototype development stage

Proving the prototype system functionality

The overall system functionality

3 – Building the final solution

As the prototype was working well it was the time to tidy up everything and to give a good looking shape to the project. I redesigned the power supply circuit mainly because of the thermal issue. But on the other hand as you know less heat means higher efficiency and in battery powered systems efficiency is important.

The full schematic of the prototype is reproduced bellow. You can easily identify the power supply with 5V for the logic circuit and 15V for the digital potentiometer, the optocouplers with the filter for parking sensors interfacing, the digital potentiometer and few LEDs used to indicate the state of the system to the user.

a) Building the solution control unit

Schematic of the solution control unit

The schematic is also available for download in pdf format here.

Top layer of the solution control unit

 The solution PCB being exposed

The etched PCB

Top side of the solution control unit PCB

Bottom side of the solution control unit PCB

Components soldering phase

The solution control unit PCB with one of the power supply ICs being soldered

Power supply functionality test – before soldering the uC

The solution control PCB ready for power supply test

            It is trivial to test the correct functionality of the power supply before soldering the uC. Also final voltage level adjustments can be done at this stage without the risk of damaging the uC.

Building the jumper board

The jumper board being prepared for execution

The uC test phase

As the uC and the firmware update socket were in place it was the time for the uC functionality test

 Firmware upload and uC functionality test

b) Enclosure Design

It is trivial to have a nice looking enclosure and a nice looking user interface in order to get the maximum value out of a project.

I started the enclosure design by sketching the place of different elements (connectors, LEDs, switches) on a piece of paper to get a rough idea about how much space different elements will take up. I tried to figure out the best combination of placing the elements to offer maximum intuitivity for the user.

Side panel initial sketch

The final design of the side panel

Side panel layout

Front panel design

Front panel layout

            It is a good practice to test the design before building the final product. In this case I tried to print the front panel layout on a piece of thin cardboard (recycled from a cereal box) but my printer couldn’t handle my cardboard all way through, then I came up with the idea of printing the font panel layout on a regular paper and to glue the paper to the cardboard.

I carefully cut the shapes out of the cardboard and I checked if my elements fit nicely in the holes. I then did final adjustments where they were required.

Testing the dimensions

Testing the front panel layout design

            To obtain a nice front panel with the holes exactly in the right position I placed a printed sheet with the font panel layout design on the top of my project box, and using a hand saw I carefully cut out the required shapes exactly in the right place.

Shaping the enclosure front cover

Cutting the shapes exactly where there are needed

            I printed the front panel layout for the last time, this time I used high quality photo paper and I printed it at the highest resolution of my printer. As you know the photo paper is quite sensitive. In order to maintain the quality of the print and to give the front panel a long lasting good look I decided to laminate the front panel print. I used thin laminating pouch so the laminating pouch was hardly noticeable and gave the photo paper a nice shiny look.

Front panel lamination

Laminating the front panel sheet

            As the project box was shaped out and the front panel sheet was printed it was the time to crop the front panel sheet and feet the components on to the front panel.

Building the front cover

Fitting the front panel elements

Front and side panel completed

Control unit overview

Assembling the Solution assisted by step by step testes

Inside view of the control unit

Wiring up the control unit

A close look on the control board after the wiring process was finished

The fully wired control board

c) Assembling the “bin horse”

When I bought the bins I paid attention to buy the ones with the closest physical dimensions to my shaft. From the initial bin-shaft matching tests you can see that the shaft fits well.

Fitting the drive shaft

Shaft – bin matching; top of the bin view

Initial tests – searching for a way of fitting the shaft

Shaft – bin matching; – bottom of the bin view

Fitting the drive shaft

I had to find out a way to attach the shaft holding frame to the bin. I cut out a part from the bottom-back side of the bin.

Bin shaping

 

 

             I decided that the best approach to attach the bin to the shaft is to place the bin on the top of the shaft supporting frame.

Attaching the shaft to the bin

            From now on the bin is called wheelie bin. I inserted the two batteries together with the control unit box in the wheelie bin. And the project was nearly done.

The assembled wheelie bin

Overview of the assembled wheelie bin

Front panel fitted. You can see the batteries on the bottom of the bin

Inside view of the wheelie bin

Front panel close up view

            We have reached the end of the project. That’s all that I have done. I managed to design a wheelie bin with tow functioning modes Auto and Manual. In the Auto mode the bin has three working speeds Stop, Slow and Fast the speed levels for the Slow and Fast are user programmable and the values are maintained even if the power supply is removed. In the Auto mode the speed of the train is controlled by the distance to the obstacle. The distance to the obstacle at which the speed is adjusted is as well user selectable trough the jumpers on the front panel.  For example if the train runs at Fast speed and an obstacle is detected at the distance selected by the JP3 (Fast – > Slow) the train slows down to Slow speed, if the distance between the obstacle and train decreases furthermore till it reach the distance selected by the JP1 (Slow -> Stop) the train will stop. Jumpers JP2 (Stop -> Slow) and JP4 (Fast -> Slow) are used to select the distance to the obstacle at which the train should increase its speed. The jumpers could be set in such a way to provide a distance hysteresis between acceleration and deceleration.

That’s all that I have done.

d) Integrating the “bin horse” in the final piece of art

This part is done by the artist itself Ciprian Muresan at his workshop in Cluj-Napoca.

The initial plan sketching

Initial sketch of the train in the exposition hall

The train construction

Train assembling

Railway construction (prototyping)

Railway sections

Testing the Wheelie Bin train in Cluj Napoca

Train test

Building the railway and initial tests at FRAC Champagne-Ardenne in Reims , France.

Train test in the exposition hall ( FRAC Champagne-Ardenne in Reims, France)

   This is the end! Thanks for watching!