It's 10 years late in the making, but now the Arduino nuggets not available anywhere else because no-one talks about the flaws in their own investment or they just don't know. The ATMega328 has a lot of performance not available in the default Arduino load.
The Arduino sketch is preprocessed into a C++ source file of some kind, which is linked into a main program in hardware/arduino/avr/cores/arduino. There are convenience macros named sbi in the main program but named setBit in the sketch.
The Arduino IDE runs a bunch of commands to preprocess, compile & flash your program. It would be easier to run a makefile from the command line, but there's no easy way to extract the commands from the IDE. Running a program requires uploading then clicking through to enable the serial monitor every time. The serial monitor resets it again.
There is no bit toggling opcode like there is on a PIC18. Toggle a bit with
bitWrite(PORTD, 2, !bitRead(PIND, 2));
Any project is going to finish as a standalone ATMega using its internal oscillator. The Arduino UNO is fixed to use a 16Mhz crystal & doesn't allow changing the clock source to the internal oscillator. This requires building up a 2nd board, using the UNO board to write a bootloader on the 2nd board. The clock source can only be set with the UNO board programmed with an ArduinoISP sketch.
Fortunately, the internal oscillator's 8Mhz speed can be simulated by setting the CLKPR register.
10 years after everyone else, it was finally time to get the Arduino going. It was decided that a totally silent fan can be made, using the motor in stepper mode, driving a continuous sine wave on all 3 phases. It wouldn't be very efficient, but it would be guaranteed to work.
The atmega328 has a huge number of PWMs, enough to drive 6 MOSFETs independently. Getting this number of PWMs requires locking them to the CPU clockspeed, so the CPU clockspeed needs to be adjusted. Completely independent frequency would reduce the number to 3 PWMs.
At 16Mhz, PWM goes at 64khz. Using the 8Mhz internal oscillator, PWM goes at 32khz. The clockspeed can be adjusted in powers of 2 & would have to be 8Mhz or below. Changing the PWM frequency also breaks all the features of the Arduino libraries, since they use the timers for other functions.
The rest of the required functionality is standard for microcontrollers, an ADC to control speed, an ADC to detect stalls.
The mane problem is the arduino IDE offers little to program a bare atmega in a circuit. The IDE can't program an atmega without a bootloader. It requires connecting the bare atmega's SPI pins, programing the Uno's atmega to program a bootloader into the bare atmega, then connecting the bare atmega's UART pins, removing the atmega on the Uno to program a main program on the bare atmega. This has to be repeated for every bare atmega.
The IDE also can't write a new bootloader on the Uno's atmega. That requires buying yet another programmer & connecting it to the ICSP header on the UNO.
The IDE & Arduino libraries have more likely served their purpose in bringing up a PWM test program. The UNO has to be reprogrammed for programming bootloaders in bare atmegas. The bootloader source has to be modified to be a main program.
A very brief test of path following was a complete failure. Machine vision did the business, but feedback was either too fast or too slow, never able to stay on the path. Maybe the machine vision was too slow. Line following robots have done this forever, but using very fast sensors.
Maybe the feedback needed low limits. Maybe instead of continually adding an offset to the heading, it needed to add offset once when the path veered 1 way & not again until the path veered the other way. Maybe the rate of change in the path is needed.
It's much more complicated than expected, for something that's just supposed to trim steering.
Anyways, either the battery was defective, never charged, or the PI sucked a lot more power than expected, but the battery went to 8.4V & the pi died. Then the 433Mhz died. It looked like a conformal coating issue. Managed to drive it home using the phone. There were signs the phone could have the same 1 handed interface as the stick & the phone could be reasonably water resistant.
After a sleepless night of using the travel fan, it obviously needed to be completely silent. PWM would never do. An ESC like none other needed to be built. It needed to use linear voltage control. It was finally a practical reason for the lifelong dream of building an ESC from scratch.
It needed to run on linear voltage down to 1V. It would be fed by a 6V BEC with some way of adjusting voltage without PWM. It would need all N MOSFETS, because the high voltage wouldn't be high enough to turn on a P.
There was technical appeal in making it out of BJT's. It would be the only one of its kind. There's a massive supply of BJT's in the apartment. They would take some voltage drop off the regulator. But to be a travel fan, it needed to be compact, so MOSFETs won out. There was still a massive supply of MOSFETs from the days of trying to launch spaceships with magnets & burning them up instead.
The 1st attempt was a through hole failure. It used P MOSFETS which would't turn on because the high voltage was too low. A more complicated circuit with N MOSFETS, a full boost converter, high side BJTs would be required.
After a month of commuting, a new electronics package was fabricated. The $5 Turnigy BEC was put to use. It was a piece of garbage that melted at 2A. The high energy BEC business is a mercenary business. They only contain a few dollars of parts, but digikey has a $25 minimum. Castle creations remanes the only supplier of a functioning high energy BEC, still charging $25 after 10 years.
A rising edge interrupt handler allows any pin on the STM32 to be used as an SPI bus, at reasonable bitrates. Piecing together forum dialogs revealed a way to access hardware SPI on the raspberry. There was a workable test program on http://www.raspberrypi.org/documenta.../spi/README.md by the name of spidev_test.c
There was never an organized way to stuff the truck.
A machine vision algorithm emerged, which could do a reasonable job tracking a path. The machine vision algorithm of choice goes at 3fps on the raspberry pi. The PI can only go up to 900Mhz. The RTL8188 is the only chip still supporting wifi access on it & it rarely stays connected longer than a few seconds.
The other problem is the algorithm only works in daylight, on a single uncrowded path near the apartment. When you have to commute 3 hours a day, you can't be home during the daytime, at all. There wasn't a chance to test it in January & probably won't be until April. There's no open space in the city to test it.
In terms of cost per clockcycle, the Odroid C1 has now been the duck's guts for several years. Development of the RTL8188 driver has continued on the Odroid, supposedly making it more bearable. It begins at $37, then the gauging begins in ernest, with exorbitant shipping, taxes, & cash only.
It makes no sense for so many middle men to now be required in payments, each adding on their own 2.5%. 30 years ago, there was just a bank. Now, it takes Paypal, Square, Apple pay, Google wallet, Coin, thousands & thousands of middle men. As middle men gauge more, new middle men emerge, promising to reduce the fees by spreading the cost of the lower middle men among a larger group. It was once said that Visa's exorbitant fees bordered on racketeering. Now, the current generation is in middle man euphoria, praising Google wallet, Apple Pay, & Square, which merely tack on other fees on top of Paypal, on top of Visa, on top of the bank. It's insane.
It's amazing all those formerly penny chinese businesses of taxi cabs, pet furniture, LED blinkers, & bike delivery are now multi billion dollar Google acquisitions. Unlike 1999, there are no IPO's. All the money is in buyouts paid to the founders. It takes a lot less people to do what took a staff, 15 years ago. There are no more tales of Netscape staff members retiring. No more tales of six figure secretaries. There are no more secretaries or IT staff. The whole show is just a CEO & an iPhone.
The long time quest for a KH-11 model ended when I remembered paper hubble models abounded. The KH-11 was once believed to be a short hubble with no instrument package. A later Kiwipedia update showed it being identical to hubble & having a large propellant tank for reboosts.
Decided to stick with the earlier theory. No matter what it really is, it's still vastly different than hubble.
The paper model wasn't as inspiring as hoped. It had to be 2.66x smaller than the NASA model to fit in the levitator. The toner fell off. The model was intended for a color printer. Left out the high gain antennas because they wouldn't fit in the levitator. Left out the instrument boxes because they would be crushed by the magnet & were microscopic.
BART has constant, massive delays. What is a 45 minute ride on paper is normally 1 hour. The delays are 1/4 caused by equipment failures & 3/4 caused by people. There is a big difference between the news & how happy people actually are, because they're obviously not getting by while the news would have you believe things suddenly got rosy on Jan 21, 2009. The reality is there are so many protests, crime, & health problems among people who are doing a lot worse than 6 years ago that nothing is working.
Living on a train for 10 hours/week is more productive than operating the break pedal in a car, but it doesn't leave any time to do anything but what can be done on a laptop. The sum total of a week of physical fabrication amounts to a very minimal revision of the Tamiya circuit board
The new board probably ended up being unnecessary, since it ended up manely removing most of the reworks instead of integrating them.
Current sensing - a decided failure. It was easier to set a constant RPM than try to adapt the RPM based on power. Couldn't get an accurate reading of current usage. The user can manually adjust RPM based on steepness.
Headlight MOSFET - not worth the extra board space. Only set once per drive. Required a gyro recalibration.
3.3V - needed connections for external regulator.
Servo - needed connections for external regulator.
ESC - Needed PWM signal on 5V pin with pad to jump to 5V. The pad didn't make it.
Last year, a car which followed the athlete instead of the path began to emerge as the best solution, but a car in front doesn't know where you're heading, only which way to turn to keep you in frame. This causes it to drive in circles.
Setting the car to follow a desired magnetic heading won't work on its own, because the magnetic heading isn't precise enough. The latest theory is if the car senses both a desired magnetic heading & the direction towards the human, it can stay on the path. This works only if the human is directly behind the car, with decreasing accuracy as the human moves alongside the car.
The car maneuvers so the angle from the human to the car to the desired magnetic heading is 180. The desired magnetic heading is changed from the stick controller to steer the car.
If the desired magnetic heading is off, following it leads the car off the path, but the human stays on the path. As the car heads off the path, the human-car-magnetic heading shrinks & the car turns back towards the path to make it approach 180 again. Wherever the human goes on the path, the car maneuvers to stay in front.
The 2nd case is the human alongside the car. This requires a different algorithm that maintains a fixed distance to the human. If the human gets farther away, the car steers to reduce the distance. This would be much less accurate than following behind the car.
The 3rd case is the human in front of the car. It just needs the...Continue Reading
Drove another 8.5 miles with the forward looking webcam. This would be the actual video technology in a path following solution. Had both batteries onboard. The old battery only went 3 miles & the new battery had more than 5.5 miles. Time to send Hobbyking another cash infusion. Also suspect 10min/mile is much less efficient for the current gearing.
Tried driving off a curb, but flipped, snapped off the wide angle lens, & this made the pi crash. Fortunately, it got 8 miles of footage. Forward looking video had much higher compression.
Edge detection showed promise, with gopro footage. Helas, JPEG compression erased too much detail & created too many macroblock lines. Would need to try again with the webcam in uncompressed mode. The wide angle lens was a waste of time for forward vision & created too many reflections.
It takes about a day to process & upload a video to the goog, so many miles of driving video have now accumulated, all on the same test trail. It's accumulated over 50 miles, since its arrival 1 month ago. To drive an RC car 50 miles, you have to run 50 miles.
A straight test of RPM vs PWM showed the dreaded stair stepping.
A test of minutes/mile using the most precise, slowest RPM feedback still showed stair stepping above RPM's where it oscillated. So either the Tamiya ESC wasn't precise enough or the mechanics had some voodoo. It's probably a limitation of all ESCs whether brushed or brushless. The next solution was to install the H-bridge from the G-buggy.